Skip to content

Instantly share code, notes, and snippets.


ennioma/post_example_realm.swift Secret

Last active Jul 6, 2017
What would you like to do?
import RealmSwift
// Define your models like regular Swift classes
class Dog: Object {
dynamic var name = ""
dynamic var age = 0
// Use them like regular Swift objects
let myDog = Dog() = "Rex"
myDog.age = 1
print("name of dog: \(")
// Get the default Realm
let realm = try! Realm()
// Persist your data easily
try! realm.write {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment