Created
February 14, 2015 07:23
-
-
Save cbess/5892062783998b67056e to your computer and use it in GitHub Desktop.
Realm Helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/** | |
Provides the default transaction block for perform a Realm transaction. | |
:param: block The block to perform the transaction. The realm is used to store the transaction. | |
*/ | |
func realmTransaction(block: (realm: RLMRealm) -> Void) { | |
let realm = RLMRealm.defaultRealm() | |
realm.beginWriteTransaction() | |
block(realm: realm) | |
realm.commitWriteTransaction() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment