class Facts {
var networkOperaton = NetworkOperation(url: "http://fact.tayfunturanligil.com")
var factsArray : [String] = []
init () {
self.networkOperaton.downloadJSONFromURL({
(a:[String]) -> [String] in
println(a)
self.factsArray = a
return a
})
}
}
When I want to create an instance of Facts in my ViewController using var facts = Facts(), factsArray stays as an empty array. But it should be getting an array from downloadJSONFromURL function. Why this is happening? Even my println(a) is not called.
I tested downloadJSONFromURL function in a playground and it works. Also, networkOperation uses NSURLSession, could this be an issue?