Implementing save states gave me the opportunity to use Swift macros for the first time! Which was simultaneously pretty awesome and very frustrating – they're very powerful but you don't get any type information when implementing them. They operate purely over syntax. I might write a blog post about it eventually.
If I wasn't trying not to require 3rd party tools, I would have used Sourcery, which is a great codegen tool that includes type information.
worktree.ca/sadlerjw/SwiftNES/