Custom authenticator in iOS

You can see the basic code I have in java in the gist - https://gist.github.com/akeemphilbert/78c55fddfce25a9653f2

@jens The java side of things was straight forward. The server side a bit more work (basically what you said with the added step of setting up a reverse proxy to make the calls all come from the same domain) . A bit disappointed that it’s not as easy in iOS as it is in Android (yet), are there any options I can consider in the mean time (short of using the existing available options, and swift examples would be doubly helpful)?