I have recently shifted to Xcode 12 and start getting error which is not there in the Xcode 11. The Error is related to an Extension which says No exact matches in call to intializer Below is the code -
public typealias UpdateBlock<T> = (_ object: T?) -> Void
protocol ModelMappeable {
func map(_ values: JSON, realm: Realm?)
}
extension ModelMappeable where Self: BaseModel {
static func getOrCreate(realm: Realm, values: JSON?, updates: UpdateBlock<Self>?) -> Self {
var object: Self!
if let primaryKey = values?["_id"].string {
if let newObject = realm.object(ofType: Self.self, forPrimaryKey: primaryKey as AnyObject) {
object = newObject
}
}
if object == nil {
object = self()
}
if let values = values {
object.map(values, realm: realm)
}
updates?(object)
return object
}
}
from No exact matches in call to intializer
No comments:
Post a Comment