Recording and Saving MIDI Sequences

Below I have included steps for Java from https://docs.oracle.com/javase/8/docs/technotes/guides/sound/programmer_guide/chapter11.html as an example. Can you help me with a similar instruction for Swift and iOS? How do I feed MusicSequenceFileCreate(::::_:) with MIDIEventList from MIDIInputPortCreateWithProtocol(::::_:) without parsing incoming MIDI events to recreate messages, one by one, with scraped raw data. I feel really embarrassed asking this question, because IMHO this should be documented, easy to find, and to do.

Recording and Saving MIDI Sequences
 
 
Q