Please have a look into the code below:
backgroundthread.async {
return self.mycallback() //return string, int etc
}
I want to return a
Like @rmaddy said, you have no other way than to use completion handlers.
func getAppConfigFromDB(_ key: String, completion: @escaping ((String) -> Any)) {
let value = String()
backgroundthread.async {
let inst = AppConfigDB.init(_APP_CONFIG_DB_PATH)
value = inst.getConfigurationInfo(key) // I want to return from here.
completion(value)
}
}
You call the method like this.
getAppConfigFromDB("") { (value) -> Any in
// Use value to do something
}