I am using this swift function inside my objective c project to parse a JSON, this function looks like this: (This function is inside NetworkService class)
static func parseJSONString(jsonString: String?, key: String?) -> () -> String{
var jsonSubString = String()
func parseString() -> String{
if let data = jsonString?.data(using: .utf8){
if let content = try? JSONSerialization.jsonObject(with: data, options: []),
let array = content as? [[String: AnyObject]]
{
for jsondict in array {
jsonSubString = jsondict[key!] as! String
}
}
}
return jsonSubString
}
return parseString
}
I want to call this function inside ViewController which is Objective C. It is a static method. Please help me in calling this function.
voidin Swift).