Programming Cocoa apps with Swift has it’s many caveats. Many of these are derived from the fact that there are two language runtimes at play, the incumbent Objective-C runtime which is used by system frameworks and the Swift runtime as a newcomer. Here is one hard lesson learned (and workaround) when dealing with state restoration problems in a Swift app.
![](https://cutecoder.org/wp-content/uploads/2021/11/cutecoder-blog-header@2x-scaled.jpg)