Kodeco Forums

Realm Tutorial

Learn about Realm, a mobile database framework on iOS. In this Realm tutorial, you'll build out a map-based app and learn how to create your data models, perform queries, fetch results, and update and delete records.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/2244-realm-tutorial

Thank you for providing such a wonderful Realm Tutorial! I read it carefully and really learned lots of thing. However, as Swift 2.2 has come out, the starter project can’t compile and many codes are outdated. Could you please update the starter project code so it can compile correctly under Swift 2.2?

Dear Bill, Thanks a lot for this tutorial.

I am using Xcode 8 with ios 10 and it appears that the starter project is not compiling.
Is there a chance that you update this tutorial ? I am learning to implement exactly this feature but I am blocked by the not compiling lines.

Thanks in advance,

Cordially

Eric

Thank you for the tutorial! Wanted to share a useful Realm library that my mobile development team built up simply to facilitate programming on Android. It’s free and everyone could get most of it. The link is here: Realm Browser for Android | SCAND. To read the expertise on how we built it you may here: Advantages of Realm Browser for Android | SCAND Blog Cheers!

Thank you for the tutorial!
While implementing swipe-to-delete feature I’m facing the following problem:
When I delete the item, the last item from the array occupies its place.

So for example I have the array [1,2,3,4,5]. After deletion of 2 (index 1) the array in the database looks this [1,5,3,4]. But table view displays everything correct [1,3,4,5]. Why is it so?

Below if the function implementation:
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
try! realm.write {
let itemToDelete = items[indexPath.row]
realm.delete(itemToDelete)
}
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Top)
}
}

I’d really appreciate your help!

Hi. How create diffrent storages for local and server’s realm?