#If you don't want to release your weapon, yes
If you don't want to release your weapon, yes
As you rightly determined, in order to handle somatic components, you need to either drop or stow your weapon to free your hand. And the same logic applies to material components.
If a spell requires a material component (PHB, 203):
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.
Using a component pouch vs a spellcasting doesn't change the calculus. Both need to be accessed by a free hand.
Do note that you can use the same hand for both somatic and material components (you don't need two free hands, just one):
To close the loops, it as you thought: you have one hand holding a sword and another hand equipping a shield.
That leaves you with zero available hands. Which means no material or somatic component access and no spellcasting for those component required spells.
Unless you have an ability, such as the improved pact weapon invocation from Xanathar's Guide to Everything, you must meet the requirement of a free hand.
You can still meet this requirement, but for a cost
##You can still meet this requirement, but for a cost HoweverHowever, you can still create a free hand on your turn in order to cast a spell with a material component.
You can either drop your weapon or sheathe your weapon and then cast your spell.
The downside to this is that you no longer are wielding a weapon. This is important for things like opportunity attacks as well as any other mechanics, like that require you to be holding your weapon. And if you're wielding a sword a shield, odds are you are in melee combat. Of course, if you drop it, it is also at risk for being picked up or moved by an enemy.
The case of costly or consumed components
##The case of costly or consumed components ForFor these, a focus doesn't matter. You need to have these components on-hand and accessible to touch. If you've got a component pouch, that should do it. Otherwise, just a pouch with those components hanging near it is identical. But you can't use a focus for these, you need the actual components.