Skip to content

Instantly share code, notes, and snippets.

Created July 10, 2022 03:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
public final class UITestingNetworkHandler {
public static func register() {
UITestingURLProcotol.responseProvider = { request in
guard let url = request.url else { fatalError() }
switch (, url.path) {
case ("", "/api/example"):
let response = HTTPURLResponse(url: url, statusCode: 200, httpVersion: nil, headerFields: nil)!
let data = "MyMockedData".data(using: .utf8)!
return .success(UITestingURLProcotol.ResponseData(response: response, data: data))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment