Okay... since no-one has actually answered your question, how about if I do it? Fact is that you (on air) could dive deeper than your instructor though for a shorter period of time according to your dive tables.
The fact that your instructor was on Nitrox mix (you didn't mention the EAN but that's not really important) informs us that the dive was within your recreational dive limits and certainly within the limits of his mix.
Your concern naturally is nitrogen loading which, when breathing Air is quicker to build at the approximate 79% as opposed to his mix which would be somewhat less (if EAN is 32 then Nitrogen is around 68) which gives him a longer time at the depth you were.
I presume he shared air with you because he didn't want to abort the dive... I've done it and I'm sure hundreds of other instructors have done it too... it doesn't make you a bad instructor nor a poor diver... you signaled that you were low and needed to surface and I'm pretty sure your instructor had plenty left to share and continue your dive.
No need to slap your hand... I think it was obvious what was going on.
Nitrox reduces the nitrogen buildup therefore you were fine breathing it - in fact, if you guaged your dive on 21% either by your RDP or off your computer, you were WELL within the safety zone when you returned to the surface.
My hats off to you for not panicing and for trusting an instructor who I feel was in full control of the situation.