This question already has an answer here:
The related question – Can you cast spells with a Somatic component if you're holding a two-handed weapon? – says that you can cast a spell if you're holding a 2H weapon. The PHB Errata says:
Two-Handed (p. 147). This property is relevant only when you attack with the weapon, not when you simply hold it.
Although, that means if you attack with the weapon, both your hands are occupied. Hence the question. Can you cast a spell you're attacking with a two-handed weapon?
An example situation
Let's say two wizards are having a squabble. Wizard 1 smacks Wizard 2 with his staff, using both hands. On his turn, Wizard 2 tries to smack Wizard 1. I assume turns happen simultaneously in D&D 5e combat. Can Wizard 1 casts Shield as a reaction, while both his hands are occupied in that very moment?
This answer implies you can cast a bonus action spell. But it is "especially swift" according to the PHB. What about a reaction spell?