Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mwrites/06608985ff4365919de594ccf1386b77 to your computer and use it in GitHub Desktop.
Save mwrites/06608985ff4365919de594ccf1386b77 to your computer and use it in GitHub Desktop.
NSURLSession Proxy configuration
let sessionConfiguration: URLSessionConfiguration = .default
let proxyConfiguration: [AnyHashable : Any] = [
kCFNetworkProxiesHTTPEnable as AnyHashable: true,
kCFNetworkProxiesHTTPPort as AnyHashable: [Place-proxy's-port-number-here],
kCFNetworkProxiesHTTPProxy as AnyHashable: "Place-your-proxy-address-here"
]
sessionConfiguration.connectionProxyDictionary = proxyConfiguration
let session: Foundation.URLSession = Foundation.URLSession(configuration: sessionConfiguration, delegate: self, delegateQueue: nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment