Reputation: 2531
I have simple class:
import Foundation
import MapKit
class OWMAPIManager {
private var params = [String : AnyObject]()
internal init(apiKey: String) {
params["APPID"] = apiKey
}
}
And I'm creating new object by this:
let weatherApi = OWMAPIManager(apiKey: "myApi key")
Problem is that after init method my array Dictionary is still empty. Can You tell me what is wrong?
Upvotes: 0
Views: 65
Reputation: 6786
As I can see you have to change the following line, I can't see everything so it is hard to guess but this might be the problem. Change that:
private var params: [String: AnyObject]?
Write me if that did it
If you remove the question mark, then it is non optional
Upvotes: 1