As you probably notices, simple screen drawing is useless if it comes to OpenGL view. So is it possible to generate UIImage from such? Of course, lets suppose your custom drawing class extends UIView, then just add:

This code works in XCode 9 and Swift 3.x.

Sooner or later, you will face the problem with object which are not deallocating. How to check if object gets deallocated? Just use deinit method like below:

If you won’t see such message when you think you class should be gone, the easiest way is to debug allocations. Because the most common reason for such behavior are strong references, you can print allocation counter this way:

But where to put this? First of all, in all you initialization methods. Just add some those prints after each few lines, and you should see where counter is growing. The same in cleanup methods, or if you dont have any, you can put this somewhere when your view controller is closing, like:

And how to avoid strong references? The most common mistake, is using self in blocks, this is the place where you should use [unowned self], this way:

Are you still using self.interfaceOrientation and getting deprecation warning? Well, don’t. Not only because it is depracated, but it can give you wrong result. Device might be in landscape mode, but a view controller that only supports portrait will remain in portrait. Solution for everything is:

which will not only return correct orientation, but also result is UIInterfaceOrientation enum so you don’t need to change your switches.

Getting “User interaction is not allowed” error in your build task? If yes, solution is very simple. Just login your build user (usually “jenkins”) via the GUI (which means VNC) and open Keychain Access. Select your signing private key, right-click, choose Get Info, change to the Access Control tab and select the “Allow all applications to access this item”.
Now error should be gone.

If you were using NSCoder in Swift 2, I’m pretty sure you used such code:

decoder.decodeObject(forKey: "name") as! String
decoder.decodeObject(forKey: "number") as! Int

Now, in Swift 3, using such construction, will cause:

fatal error: unexpectedly found nil while unwrapping an Optional value

So is there any solution for this? Yes, you need to use explicit methods to integers, floats, bools and some other types. Just rewrite this code as:
decoder.decodeObject(forKey: "name") as! String
decoder.decodeInteger(forKey: "number")

And this error will be gone. Available methods below:
decodeBool
decodeInteger
decodeCInt (returns Int32)
decodeInt32
decodeInt64
decodeFloat
decodeDouble
decodeBytes

So you are trying to send instant message to parent iPhone app and still receiving “Payload could not be delivered”? This happens only if one of those two thing occured:
1. there is no connection to watch (you should check session.reachable in WCSession)
2. your iPhone app is not responding with didReceiveMessage:replyHandler:

Second one is the most probably so how to fix it? There are 2 “didReceiveMessage” methods in WCSessionDelegate protocol, to make it work, you need to implement second one:

so just make it look like:

You just need to respond with NSDictionary. And it works. Really.