Yes
This is something you can do. If you have two attacks, you can even fire from the longbow, then hold the bow in one hand draw the sword and attack with it with the second attack. You can also sheathe the sword and attack with the longbow again in the following round. You seem to grasp the limitations of those actions.