Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Extending NSCoding
protocol Archivable: NSCoding {
var archivedData: Data { get }
}
extension Archivable {
var archivedData: Data {
return NSKeyedArchiver.archivedData(withRootObject: self)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment