Unable to access class member inside the pod

1.1k Views Asked by At

Im accessing a variable inside a class of my pod. The members inside the class have internal access modifier. But cannot able to access the tenantURL from the networking class. Why this happens?

SDKCore class

public class SDKCore {

    public static let shared = SDKCore()

    var accessToken: String
    var tenantURL: String
    var clientSecret: String
    var appId: String

    init(accessToken: String, tenantUrl: String, clientSecret: String, appId: String) {
        self.accessToken = accessToken
        self.tenantURL = tenantUrl
        self.clientSecret = clientSecret
        self.appId = appId
    }

    static var getInstance: ApiClient = {
        return ApiClient()
    } ()
}

Networking class

class Networking {

    func performFileDownload(path: String, completionHandler: @escaping (ResultModel<DataResponse<Data>, Error>) -> Void) {
        let fileUrl = SDKCore.tenantURL + path

        alamofire.request(fileUrl)
            .responseData { (response) in
                switch response.result {
                case .success(_):
                    completionHandler(.success(response))
                case .failure(let error):
                    completionHandler(.failed(error))
                }
        }
    }

Use of unresolved identifier 'SDKCore'

Pod Directory structure

1

There are 1 best solutions below

4
On BEST ANSWER

If you look at your code, it clearly visible that tent tenantURL is instance variable not the class one,

SDKCore.shared.tenantURL

Also Try to clean your project and reinstall the pods