i currently developpe an app which request data from a webservice, and one the datas are retrieve, i call a method to create some "swype" card like tinder.
The problem is, i do not success to call my method in the viewDidload, this is my code :
if(success == 1) {
NSLog("Recherche OK");
//Call the swype method
}
This is my method :
func fetchData(int: Int, completion: (()->())?) {
let newCard = Model()
//ttp://thecatapi.com/api/images/get?format=src&type=png
if let url = NSURL(string: "http://test.com/api/images/get?format=src&type=png") {
if let data = NSData(contentsOfURL: url) {
newCard.image = UIImage(data: data)
newCard.content = "test"
newCard.desc = "test"
self.data.append(newCard)
NSLog("fetch new data")
}
Have you got an idea ?