physical keyboard handling in iOS

hello, what is the best way to handle this request:


when user presses return/enter on a physical keyboard connected to iOS device the app shall do one thing (take the contents of UITextView and proceed with it), and when the user presses alt+return/enter on a physical keyboard the app shall do another thing (treat it as a usual text input and change UITextView contents accordingly). ideally when user pastes the "\n" symbol via copy / paste the app shall treat it as a normal text input following the second path, but that requirement can be sacrificed.


i tried overriding pressesBegan in a UITextView subclass but don't see it being called.


is there a way to take the current keyboard modifiers on iOS? (similar to the ancient GetKeys on mac for those who remember)