I'm trying to init an array of Int in my custom UIView:
var graphPoints:[Int]
required init?(coder aDecoder: NSCoder) {
RestApiManager.sharedInstance.requestData() { (json: JSON) in
for item in json[].array! {
let n=item["n"].intValue
print(n)
if(n>=0) {
self.graphPoints.append(n)
}
}
}
super.init(coder: aDecoder)
}
But int this row RestApiManager.sharedInstance.requestData() {
i reiceved this error: 'self' used before super.init call
And at this row super.init(coder: aDecoder)
the error: property self.graphPoint not initialized at super.init call