Instruments shows that these lines of code cause memory leaks, what am I doing wrong?
required init(data: JSON) {
self.type = data["type"].stringValue
self.name = data["name"].stringValue
self.numberOfRestaraunts = data["length"].intValue
self.isFavourited = data["isFavourited"].boolValue
self.image = URL(string: data["img"].stringValue)! //<- this
self.id = data["id"].stringValue
self.headerImage = URL(string: data["header"].stringValue)! //<- this
if data["colorSchema"].stringValue == "Dark" {
self.colorTheme = .dark
} else {
self.colorTheme = .light
}
self.color = data["color"].stringValue
self.metaScore = data["metaScore"].intValue
self.typeMetaScore = data["typeMetaScore"].int ?? 0
}
It actually shows, that leaks are NSURL
class.
EDIT: Screenshots: