I'm getting an error stating: Property 'clientChatLoad' not found on object of type 'DataManager' when using the following implementation:
AppDelegate.m
#import "IOS_Project_Name-Swift.h"
@class DataManager;
...
DataManager.clientChatLoad(0){ data, error in
guard data != nil else {
print(error)
return
}
guard let data = data else { return }
let json = JSON(data: data)
if let result = json["success"].bool{
if (result){
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(0.5 * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in
NSNotificationCenter.defaultCenter().postNotificationName("refreshChatDetails", object: nil, userInfo:nil)
}
}
}
DataManager.swift
...
@objc class func clientChatLoad(_ chatId: Int, completionHandler: @escaping (Data?, NSError?) -> ()) -> URLSessionTask {
// AJ TO-DO
var defaults = UserDefaults.standard
let URL = Foundation.URL(string: chatUrl)!
var request = URLRequest(url: URL, cachePolicy: .reloadIgnoringLocalAndRemoteCacheData, timeoutInterval: 3.0)
request.httpMethod = "POST"
...
From what I understand adding @class DataManager
to my Objective C class as well as @objc
before class func clientChatLoad
should expose the Swift code to my Objective C class... but I still receive an error. What might I have overlooked?