I wan\'t to check if my url statusCode equals to 200, I created a function returning a Boolean if the statusCode equals to 200, I\'m using a dataTask, but I don\'t know how
You're returning a value from a Void function that is the completionHandler closure of dataTask(_:, _:)
Regarding your code, there is something wrong: you can't return that value because it's executed on a different thread, it's an asynchronous operation. Please take a look at this thread: Returning data from async call in Swift function