Skip to content

Instantly share code, notes, and snippets.

@brandonasuncion
Last active March 12, 2019 21:36
Show Gist options
  • Select an option

  • Save brandonasuncion/0e597d8a6fcbde19d314099560f2142f to your computer and use it in GitHub Desktop.

Select an option

Save brandonasuncion/0e597d8a6fcbde19d314099560f2142f to your computer and use it in GitHub Desktop.
class CustomUrlProtocol: URLProtocol {
static var requestCount = 0
open override class func canInit(with request: URLRequest) -> Bool {
guard let url = request.url else { return false }
requestCount = requestCount + 1
print("NSURLREQUEST: \(request)")
return false
}
}
URLProtocol.registerClass(CustomUrlProtocol.self)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment