我正在使用Realm并且我创建了一个User
模型。用户可以通过该应用注册。当他这样做时,我要做的就是POST
我的User
实例。
以下是我开始做的事情:
let params = currentUser as? Dictionary<String, AnyObject?>
octoClient.post("/users", options: params) { (data) in
// ...
}
我正在寻找的是:
class User: Object {
dynamic var id = ""
dynamic var firstName = ""
dynamic var lastName = ""
dynamic var email = ""
dynamic var phone = ""
dynamic var postalCode = ""
dynamic var state = ""
dynamic var country = ""
dynamic var city = ""
dynamic var address = ""
dynamic var category = List<Industry>()
dynamic var birthday = NSDate()
dynamic var password = ""
dynamic var passwordConfirmation = ""
let notifications = List<Notification>()
dynamic var privateToken = ""
dynamic var createdAt = NSDate()
func toDictionary() -> [String: AnyObject?] {
// format current instance to wanted format
return [String: AnyObject?]()
}
}