Skip to content

Instantly share code, notes, and snippets.

/after.swift Secret
Created Feb 20, 2018

Embed
What would you like to do?
let environment = try Environment.writable(directoryURL: directoryURL)
let database: Database<String, String, Map> = try transaction.open(database: nil)
try environment.write { transaction in
for (key, value) in ["lorem": "ipsum", "dolor": "sit amet"] {
try transaction.put(value: value, forKey: key, in: database)
}
}
try environment.read { transaction in
print(try transaction.getValue(forKey: "lorem", in: database))
// Console: "ipsum"
print(try transaction.values(in: database))
// Console: ["lorem": "ipsum", "dolor": "sit amet"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.