Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. class Login_item: Object {
  2. dynamic var username = String()
  3. dynamic var password = String()
  4.  
  5. override static func primaryKey() -> String? {
  6. return "username"
  7. }
  8.  
  9. func save_login_info() {
  10. let new_login_entry = Login_item()
  11.  
  12. new_login_entry.username = Username.text!
  13. new_login_entry.password = Password.text!
  14.  
  15. let realm = try! Realm()
  16. try! realm.write {
  17. realm.add(new_login_entry)
  18. print("Login info save as: (Realm.Configuration.defaultConfiguration.fileURL!)")
  19. }
  20.  
  21. try! realm.write {
  22. realm.add(new_login_entry, update: true)
  23. }
  24. }
  25.  
  26. let config = Realm.Configuration(schemaVersion: 1, migrationBlock: { migration, oldSchemaVersion in
  27. if oldSchemaVersion < 1 {
  28.  
  29. }
  30. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement