Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Login_item: Object {
- dynamic var username = String()
- dynamic var password = String()
- override static func primaryKey() -> String? {
- return "username"
- }
- func save_login_info() {
- let new_login_entry = Login_item()
- new_login_entry.username = Username.text!
- new_login_entry.password = Password.text!
- let realm = try! Realm()
- try! realm.write {
- realm.add(new_login_entry)
- print("Login info save as: (Realm.Configuration.defaultConfiguration.fileURL!)")
- }
- try! realm.write {
- realm.add(new_login_entry, update: true)
- }
- }
- let config = Realm.Configuration(schemaVersion: 1, migrationBlock: { migration, oldSchemaVersion in
- if oldSchemaVersion < 1 {
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement