I'm currently playing a character that can switch fairly easily between a front-line tank and a spellcaster. I know that for my material components I will require a hand free to access my component pouch/focus or to use somatic gestures. The problem is, I plan to be using a sword and shield most of the time. I know I can sheathe a sword as part of a move action, but what about a shield? Shields technically count as light armor, but the donning/doffing rules only seem to apply to a set of armor. So, how quickly can I take my shield off so that I can cast a spell?
It takes an action to don and to doff a shield (See Pg 146 of the PHB).
However, you can always drop your sword, cast your spell, and pick your sword back up with your interact with object free action. The important thing here is that the intent of the rules is to not kill you on the action economy for casting while wielding a weapon. This answer has more details.
Also, if you only need somatic components, the Warcaster feat (Suggested by John) will help you with this. It allows you to use your shield hand while performing somatic components (it strangely doesn't mention material components, which is an unfortunate oversight). It also has other benefits for casting in melee which you'll want to take advantage of.