I have a function that is supposed to get json data and return it. This is the function below:
func httpjson(){
    let requestURL: NSURL = NSURL(string: "http://www.learnswiftonline.com/Samples/subway.json")!
    let urlRequest: NSMutableURLRequest = NSMutableURLRequest(URL: requestURL)
    let session = NSURLSession.sharedSession()
    let task = session.dataTaskWithRequest(urlRequest) { (data, response, error) -> Void in
        let httpResponse = response as! NSHTTPURLResponse
        let statusCode = httpResponse.statusCode
        if (statusCode == 200) {
            print("All OK!")
            do{
                let json = try NSJSONSerialization.JSONObjectWithData(data!, options:.AllowFragments)
                return json
            }catch {
                print("Error with Json: \(error)")
            }
        }
    }
    task.resume()
}
The code returns the error Unexpected non-void return value in void function
After reading a little about this issue, I read that this can be fixed by changing func httpjson(){ to func httpjson()-> String{ but it still returns the same error.
 
    