Realm with Swift 2.0
TA-DA this is name of this example app. I like funny sound like Minions say Taa-Daa haha… it very relax sound. K we will create mini-project for show how to use Realm with Swift 2.0. I think a lot of iOS Developer even try to use Core Data ….. but someone give up because it difficult for understand…. sure me too :P.
Now! comes the solution. We have Realm, it is a mobile database easy to use, fast, cross-platform, advanced and bla bla bla.
I can’t explain a lot of detail but now you and me will go to try with easy example project for understand the power of Realm.
- Init project, install reaml by cocoapod to project, init to-do model.
- Create xcode project
- Install Realm follow how to : Install Realm to project
- Create Realm Object – TDTask model
- Create tableview for list to-do task
- Get all task in Realm database
- Create to-do form for input to-do data
- and create save function for insert task to database
- BAMM! Now task will store on mobile database
- Update/Edit to-do task object and show status in tableview.
- Now we can edit task object it very easy to update object, we open write transaction use realm.beginWrite() and update task object and save update data with try! realm.commitWrite().
- Filtering realm object with NSPredicate.
- Sorting object with sorted function.
I’ll show how to queries with Chaining and other useful technic with Realm.
Fork this project on GitHub
Thank nice image from