I'm playing a bard that uses a viol but it takes 2 hands to play it so how would I be able to quickly switch between spellcasting focus and my weapons? Does it take extra time or does it not matter?
Yes, it takes time, but check the required components on the spells you're casting - it may not matter.
Focus & Hands
That said, if you're using a single-handed weapon without a shield, there's no reason for you to put the instrument away at all. You don't need both hands to cast with it, so you can keep a weapon in the other one. The rules allow using the same hand for somatic and material components for spells that require both, though if it has just somatic components, the hand must be empty.
A spellcaster must have a hand free to access a spell's material components -- or to hold a spellcasting focus -- but it can be the same hand that he or she uses to perform somatic components.
Use An Object is normally an action, but certain situations allow you to do it while doing something else:
You normally interact with an object while doing something else, such as when you draw a sword as part of an attack. When an object requires your action for its use, you take the Use an Object action. This action is also useful when you want to interact with more than one object on your turn.
If you're using a two-handed weapon, or you're using a shield, you'll need to spend an action to put the instrument away (or drop it for free). There isn't another action that putting the instrument away could be part of, so you can't do it for free. On your next turn, you can then draw-and-attack.
It's worth noting that quite a few bard spells do not have material components at all. Depending on what you're casting, you may not want to have your focus in hand to begin with - you can cast with an open hand one round, then draw-and-attack the next.
As an aside, because it affects somatic not material components, is the Warcaster feat. For a Valor bard, who may very well be using a shield, the ability to cast somatic component spells without putting a weapon away may be beneficial.
See T.J.L great answer for why it does take time to take out and put away your focus.
I am going to give you examples of how much doing so matters.
How much it matters to switch between your weapons and your focus depends on what kind of weapons you are using to fight.
For simplicity's sake, in my examples the character has no feats, wants to use a focus, and does not want to drop what its holding onto the ground (which is entirely free, but also very desperate RP-wise).
There are 3 scenarios:
A one-handed weapon
In this scenario there is no problem at all. One hand holds the one-handed weapon, the other hand holds the focus and performs somatic components.
A two-handed weapon or an ammunition weapon
You need two hands to attack with these kind of weapons, but you only need one hand to hold onto them while you are doing other things. This means that you never need to put your weapon away, so your object interaction is barely enough to do everything you need:
- If you want to cast a spell, you aren't holding your focus, and your still have your object interaction, then you just grab the focus;
- If you want to attack with your weapon, you are holding onto both your focus and your weapon, and you still have your object interaction, then you just put your focus away.
Two one-handed weapons or a one-handed weapon with a shield.
In this scenario it is still possible to juggle everything if you plan one turn ahead and you switch between weapons and focus at most every other turn:
- If you are holding onto two-weapons (or a weapon & a shield), you know you need to cast a spell next turn, and you still have your object interaction, then this turn (after you attack or whatever) you sheath a weapon and next turn grab your focus;
- If you are holding onto your focus and a weapon (or a shield), you know you need to attack next turn, and you still have your object interaction, then this turn (after you cast a spell or whatever) you put away your focus and next turn you unsheathe your weapon.
An important limitation with some of these scenarios is that you end some turns while your weapon is sheathed or un-wield-able so you cannot do attacks as a reaction, etc.
Feats like dual wielder and war caster can solve some or all of these problems.
Moreover, using a component pouch instead of a focus also solves some of these problems, because you never need to hold onto your component pouch or put it away, you only need a free hand to grab the material (which you do for free while casting a spell).