Skip to content

Commit bc58703

Browse files
authored
Merge pull request #55 from TaskarCenterAtUW/feature-answer-base
Update DatabaseConnector.swift
2 parents 5cf998d + cd1c8a9 commit bc58703

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

GoInfoGame/GoInfoGame/DataBase/DatabaseConnector.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,16 @@ class DatabaseConnector {
225225
func addWayTags(id: String, tags:[String:String]) -> StoredWay? {
226226
guard let theWay = getWay(id: id) else { return nil }
227227

228-
tags.forEach { (key: String, value: String) in
229-
theWay.tags.setValue(value, forKey: key)
228+
do {
229+
try realm.write {
230+
tags.forEach { (key: String, value: String) in
231+
theWay.tags.setValue(value, forKey: key)
232+
}
233+
}
234+
}
235+
catch {
236+
print("Error while writing tags")
230237
}
231-
232-
realm.add(theWay, update: .all) // Test this
233238
return theWay
234239
}
235240
/**

0 commit comments

Comments
 (0)