RealmSwift in the iOS problem with block 'write'


I am getting one more issue regarding write block - 'SharedRealm.realm.write()' - Error - "Call can throw, but it is not marked with 'try' and the error is not handled", how it can be handled.

This is the code:

func addItems(items:[Item]) {
    do {
        let rlm = try Realm()

        rlm.write { () -> Void in
            for item in items {
                rlm.add(item, update: true)
    catch let rlmError {
        print("Realm() generated error: \(rlmError)")

Still I am getting the same error - ":13: Call can throw but is not marked with 'try'"

rlm.write { ... } might throw an error as well as the initializer so you will need to add the try operator in front of this invocation, too.