Forked from giulio92/In_your_networking_class.swift
Created
February 1, 2018 07:36
-
-
Save mwrites/06608985ff4365919de594ccf1386b77 to your computer and use it in GitHub Desktop.
NSURLSession Proxy configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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