Files
Pulse/Demo/iOS/Pulse_Demo_iOSApp.swift
Alex Grebenyuk e2b4349ce0 Version 3.6.0
2023-04-22 10:23:26 -04:00

46 lines
1.3 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// The MIT License (MIT)
//
// Copyright (c) 20202023 Alexander Grebenyuk (github.com/kean).
import SwiftUI
import Pulse
import PulseUI
@main
struct Pulse_Demo_iOSApp: App {
var body: some Scene {
// let _ = testProxy()
WindowGroup {
NavigationView {
ConsoleView(store: .demo)
}
}
}
}
var task: URLSessionDataTask?
private func testProxy() {
// Experimental.URLSessionProxy.shared.isEnabled = true
URLSessionProxyDelegate.enableAutomaticRegistration()
let session = URLSession(configuration: .default, delegate: MockSessionDelegate(), delegateQueue: nil)
let task = session.downloadTask(with: URLRequest(url: URL(string: "https://github.com/kean/Nuke/archive/refs/tags/11.0.0.zip")!))
// task = session.dataTask(with: URL(string: "https://github.com/CreateAPI/Get")!)
task.resume()
}
private final class MockSessionDelegate: NSObject, URLSessionDelegate, URLSessionTaskDelegate, URLSessionDownloadDelegate {
var completion: ((URLSessionTask, Error?) -> Void)?
func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
completion?(task, error)
}
func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) {
print("here")
}
}