Enums are lowerCamelCased nowadays, and paramaters should be made explicit.
Try testing it in a XCode8 Playground context.
import Foundation
letheaders=["authorization":"Bearer eyJhbGciOiJSUzI1NiJ","content-type":"application/json"]varrequest=NSMutableURLRequest(url:URL(string:"http://foo.bar/api/items")!, cachePolicy:.useProtocolCachePolicy, timeoutInterval:10.0)
request.httpMethod ="GET"
request.allHTTPHeaderFields = headers
letsession=URLSession.shared
letdataTask= session.dataTask(with: request asURLRequest, completionHandler:{(data, response, error)->Voidiniflet e = error {print(e)}else{iflet httpResponse = response as?HTTPURLResponse{print(httpResponse)}}})
dataTask.resume()
Enums are lowerCamelCased nowadays, and paramaters should be made explicit.
Try testing it in a XCode8 Playground context.