Using Swift KeyPaths for Beautiful User Preferences

Using Swift KeyPaths for Beautiful User Preferences

In this post I’ll show you a way I’ve used KeyPaths in Swift to drastically improve how I architected a settings screen. This post will assume you have some knowledge of how Realm works, since an explanation of that is definitely out of the scope of this post.

[…]

I propose a very Swifty solution, leveraging the new KeyPath in Swift 4.0, and mixing it with Realm (a persistence framework) to make your settings code beautifully self-sufficient and encapsulated.

[…]