This file contains hidden or 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
| func fetchData(url: URL) async throws -> Data { | |
| let cancellables = NSMutableSet() | |
| return try await withTaskCancellationHandler { | |
| try await withCheckedThrowingContinuation { continuation in | |
| let cancellable = APIClient() | |
| .request(url: url) | |
| .sink { completion in | |
| switch completion { | |
| case .failure(let error): | |
| continuation.resume(throwing: error) |
This file contains hidden or 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
| import SwiftUI | |
| struct ContentView: View { | |
| @State var size: CGSize = .zero | |
| var body: some View { | |
| VStack { | |
| Text(size.debugDescription) | |
| ChildView() | |
| } |
This file contains hidden or 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
| import SwiftUI | |
| struct ContentView: View { | |
| @State var isShrinked = false | |
| @State var response: CGFloat = 1 | |
| @State var dampingFraction: CGFloat = 0.5 | |
| @State var blendDuration: CGFloat = 0 | |
| var body: some View { | |
| VStack { |
This file contains hidden or 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
| import SwiftUI | |
| // ... | |
| SomeView() | |
| .background(UIViewControllerLifecycleView( | |
| onViewWillAppear: { | |
| }, onViewDidAppear: { | |
| }, onViewWillDisappear: { | |
| }, onViewDidDisappear: { | |
| }) |
This file contains hidden or 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
| struct MyScrollView<Content: View>: UIViewRepresentable { | |
| let axis: Axis | |
| @ViewBuilder let content: () -> Content | |
| class Coordinator: NSObject, UIScrollViewDelegate { | |
| var hostingController: UIHostingController<Content>? | |
| } | |
| func makeCoordinator() -> Coordinator { | |
| Coordinator() |
OlderNewer