Case #1: You are already holding two swords.
The rules for Two Weapon Fighting state:
When you take the Attack action and attack with a light melee weapon that you're holding in one hand, you can use a bonus action to attack with a different light melee weapon that you're holding in the other hand. You don't add your ability modifier to the damage of the bonus attack, unless that modifier is negative.
The Bladesinger's Extra Attack feature reads:
You can attack twice, instead of once, whenever you take the Attack action on your turn. Moreover, you can cast one of your cantrips in place of one of those attacks.
So when you do (attack + cantrip), you are taking the attack action and the first attack is with a light melee weapon. Therefore, you would qualify for the bonus action attack from Two Weapon Fighting, if you are holding a light melee weapon in each hand.
This is a problem. As discussed in this Q&A, you must be holding the second weapon when you take the first attack: Does Two-Weapon fighting work if you aren't holding both weapons when you take the Attack action?
This means that for this combo to work, we must be holding two light melee weapons at the beginning of the attack action. Since Somatic components require a free hand, we are now limited to casting a cantrip that does not have Somatic components. Fortunately, there are three such damaging cantrips on the Wizard spell list:
- Lightning Lure
- Mind Sliver
- Sword Burst
Assuming we cast one of the three cantrips above, and are holding two short swords, the following turn is valid:
- Take first attack of Attack action with short sword
- Use second attack of Attack action to cast Sword Burst
- Two Weapon Fighting bonus action attack with short sword.
Case #2: One sword is sheathed - you must cast the cantrip first.
In this case, we assume we start with one sword in hand, and one sword in the sheathe. Here, it is crucial that we cast the cantrip first. This is permitted; the Bladesinger's Extra Attack feature says:
You can attack twice, instead of once, whenever you take the Attack action on your turn. Moreover, you can cast one of your cantrips in place of one of those attacks.
So we can replace the first attack with a cantrip. At the time of casting, we have one free hand, so we are not limited to the three cantrips discussed in Case #1, we can cast any cantrip we know. Then, for the second attack, we draw our second sword and make a melee attack with one of them. This is permitted:
Here are a few examples of the sorts of thing you can do in tandem with your movement and action:
- draw or sheathe a sword
So Let's review our turn so far: we have taken the Attack action and we are holding two light melee weapons in each hand when we attack with one of them. This is all that is necessary to qualify for the Two Weapon Fighting bonus action attack. So we may take it. Therefore, this is a valid turn:
- Use first attack of Attack action to cast firebolt
- Use object interaction to draw second sword
- Use second attack of Attack action to make a melee attack with a shortsword
- Use Two Weapon Fighting bonus action to make a melee attack with the other sword.
Case #3: Booming Blade and Green-Flame Blade, order doesn't matter.
These cantrips will also work, though it takes a bit of analysis to get there. BB and GFB have Somatic and Material Components. As mentioned previously, Performing Somatic components usually requires a free hand:
If a spell requires a somatic component, the caster must have free use of at least one hand to perform these gestures.
But BB and GFB create a special exception for our case here. The rules for Material components state:
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.
The Material component for BB and GFB is:
a melee weapon worth at least 1 sp
Because our short sword is the material component for these spells, a hand that is holding a shortsword can be the hand we use for the Somatic components. Therefore, the following turn is also valid:
- Take first attack of Attack action with short sword
- Use second attack of Attack action to cast Booming Blade
- Two Weapon Fighting bonus action attack with short sword.
Case #4: War Caster (with component pouch).
The War Caster feat busts this thing wide open with its second feature:
- You can perform the somatic components of spells even when you have weapons or a shield in one or both hands.
The feature basically removes any and all limitations. Because you can now perform Somatic components with one of your hands that is holding a sword, that hand can also access material components stored in a component pouch. As mentioned previously:
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.
Since we are performing Somatic components with a hand holding a sword, this rule allows us to use that same hand to provide Material components from a component pouch:
A character can use a component pouch or a spellcasting focus (found in “Equipment”) in place of the components specified for a spell.
You can hold two swords, cast any cantrip you like, with either your first or second attack, and still qualify for the Two Weapon Fighting bonus action attack. This feat really is a must-have for Bladesingers (if your DM is permitting use of feats), the other two features are incredibly useful as well:
- You have advantage on Constitution saving throws that you make to maintain your concentration on a spell when you take damage.
- When a hostile creature's movement provokes an opportunity attack from you, you can use your reaction to cast a spell at the creature, rather than making an opportunity attack. The spell must have a casting time of 1 action and must target only that creature.
Case #5: Ruby of the War Mage
There is a magic item called the Ruby of the War Mage that can serve as a functional substitute for the feature of War Caster mentioned previously:
this 1-inch-diameter ruby allows you to use a simple or martial weapon as a spellcasting focus for your spells. For this property to work, you must attach the ruby to the weapon by pressing the ruby against it for at least 10 minutes.
Ruby of the War Mage turns one of your swords into a spellcasting focus for your spells. A spellcasting focus is able to substitute for the Material components of your spells:
A character can use a component pouch or a spellcasting focus (found in “Equipment”) in place of the components specified for a spell.
And since this sword hand is now providing material components, it can now be the hand that is providing Somatic components:
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.
The outcome here is similar to having War Caster: you can hold two swords, cast any cantrip you like, with either your first or second attack, and still qualify for the Two Weapon Fighting bonus action attack.