 		self.name = name
 		self.favorited = favorited
 		self.state = state
+
+		super.init()
 	}
+
+	// MARK: NSCoding
+	func encode(with aCoder: NSCoder) {
+		aCoder.encode(guid, 	forKey: PropertyKey.guidKey)
+		aCoder.encode(name, 	forKey: PropertyKey.nameKey)
+		aCoder.encode(favorited,forKey: PropertyKey.favoritedKey)
+		aCoder.encode(state, 	forKey: PropertyKey.stateKey)
+	}
+
+	required convenience init?(coder aDecoder: NSCoder) {
+		let guid = aDecoder.decodeObject(forKey: PropertyKey.guidKey) as! String
+		let name = aDecoder.decodeObject(forKey: PropertyKey.nameKey) as? String
+		let favorited = aDecoder.decodeBool(forKey: PropertyKey.favoritedKey)
+		let state = aDecoder.decodeObject(forKey: PropertyKey.stateKey) as! TodoState
+
+		self.init(guid: guid, name: name, favorited: favorited, state: state)
+	}
+
 
 	// MARK: Equatable
 	static func ==(lhs: Todo, rhs: Todo) -> Bool {

import Foundation

class Todo: NSObject {

	var guid: String!
	var name: String?
	var favorited: Bool!
	var state: TodoState!

	convenience override init() {
		self.init(guid: nil, name: nil, favorited: false, state: .NotDone)

		self.init(guid: nil, name: name, favorited: favorited, state: state)
	}

	// MARK: Initialization
	init(guid: String?, name: String?, favorited: Bool, state: TodoState) {

		if let localGuid = guid {
