Jul 21, 2017 · 1 min read
As a suggestion, consider changing the extension to:
extension NSCoder {
class var empty: NSCoder {
let data = NSMutableData() let archiver = NSKeyedArchiver(forWritingWith: data) archiver.finishEncoding() return NSKeyedUnarchiver(forReadingWith: data as Data) }
}
This would allow you to later use stuff like:
MyViewController(coder: .empty)
Which makes for a nicer API on the consumer (though with your approach you could use just .empty())
