An easy way to manage your Realm Database with Swift
This library uses library from RealmManager by markcdb - trying to make it easier to manage your own databases with REALM.
- iOS 9
- ARC
MMRealmWrapper is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MMRealmWrapper'
-
- Parameter version: version number of your DB. Increment your version number when you have to update your db file.
public func configureDB(version: UInt64)
-
- ApplicationGroupIdentifier: Application Security Group Identifier defined on iTunesConnect account like app.identifier.com. Version:number of your DB. Increment your version number when you have to update your db file.
public configureSharedDB(ApplicationGroupIdentifier:String, version: UInt64)
-
- Save Realm Object
public func save(T: Object)
-
- Save Realm Object with completion: returns success or not for this task.
public func saveWithCompletion(T: Object?, completion: @escaping (_ success : Bool) -> Void)
-
- Save an Array of Realm Objects with completion: returns success or not for this task.
public func saveArrayObjects(T: [Object], completion: @escaping (_ success : Bool) -> Void)
-
- Get array of objects by class
public func getAllListOf(T: Object, completionHandler: @escaping(_ result:[Object]) -> Void)
-
- Get unique object by Identifier
public func getFetchObject(T: Object, objectID: String, completionHandler: @escaping(_ result:Object?) -> Void)
-
- Get unique object by custom primary key for Realm Object
public func getFetchObjectWithCustomPrimareyKey(T: Object, objectPrimaryKey: String, objectPrimaryKeyValue: String, completionHandler: @escaping(_ result:Object?) -> Void)
-
- Get list of objects by condition
public func getFetchList(T: Object, condition: String?, completionHandler: @escaping(_ result:[Object]) -> Void)
-
- Delete object providing Identifier
public func deleteObjectById(T: Object, objectID: String, completionHandler: @escaping(_ success:Bool) -> Void)
-
- Delete object providing your own customPrimareyKey
public func deleteObjectByCustomPrimaryKey(T: Object, objectPrimaryKey: String, objectPrimaryKeyValue: String, completionHandler: @escaping(_ success:Bool) -> Void)
-
- Delete object / objects by condition
public func deleteObjectByCondition(T: Object, condition: String, completionHandler: @escaping(_ success:Bool) -> Void)
-
- Delete all objects of class
public func deleteAllObjectWithCompletion(T: Object, completionHandler: @escaping(_ success:Bool) -> Void)
-
- Delete object providing a object
public func deleteObjectWithCompletion(T: Object, completionHandler: @escaping(_ success:Bool) -> Void)
-
- Delete all database
public func deleteAllDataBase()
iMark21, [email protected]
MMRealmWrapper is available under the MIT license. See the LICENSE file for more info.