我已经创建了一个向导供用户使用我的应用程序进行注册,但是,我对如何存储他们的信息存在疑问.
我有一个User模型,当用户从数据库中拉出时填写,但是,如果我将它用作用户传递的对象,则此模型上有一些必填字段将无法填写通过向导.
这是我的User模型:
final class User: NSObject, ResponseObjectSerializable, ResponseCollectionSerializable {
let id: Int
var facebookUID: String?
var email: String
var firstName: String
var lastName: String
var phone: String?
var position: String?
var thumbnail: UIImage?
var timeCreated: CVDate
init?(response: NSHTTPURLResponse, var representation: AnyObject) {
if let dataRepresentation = ((representation as! NSDictionary).valueForKey("data") as? [String: AnyObject]) {
representation = dataRepresentation
}
self.id = representation.valueForKeyPath("id") as! Int
self.facebookUID = (representation.valueForKeyPath("facebook_UID") as? String)
self.email = (representation.valueForKeyPath("email") as? String) ?? …Run Code Online (Sandbox Code Playgroud)