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
extension Result where Failure == Error { | |
init(_ task: @escaping () async throws -> Success) async { | |
self = await withCheckedContinuation { [task] continuation in | |
Task { | |
do { | |
continuation.resume(returning: .success(try await task())) | |
} catch { | |
continuation.resume(returning: .failure(error)) | |
} | |
} |
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
extension Task where Success == Never, Failure == Never { | |
/// Suspends the current task for at least the given duration in seconds. | |
/// Throws if the task is cancelled while suspended. | |
/// - Parameter seconds: The sleep duration in seconds. | |
static func sleep(seconds: TimeInterval) async throws { | |
try await Task.sleep(nanoseconds: UInt64(seconds * 1_000_000_000)) | |
} | |
} |
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
Here's a prioritized list of all available tasks. | |
The ones marked with [R] are required (e.g. you need to complete before moving on), and the ones marked as [O] are optional (you still have to do them, but they include a direct link to the solution). | |
- [ ] [R] #1 **Change app window title** | |
- [ ] [R] #3 **Improve Table UI** | |
- [ ] [R] #2 **Finish server code** | |
- [ ] [O] #4 _Change status column width_ | |
- [ ] [O] #5 _Change UI for error rows_ | |
- [ ] [O] #6 _Finilize table UI_ |
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
0x4eEe2E90cd061E8eC4997cdCf94c348f137DD4F5 |
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
import UIKit | |
import XCTest | |
class SwapOptimizedTests: XCTestCase { | |
override func setUp() { | |
super.setUp() | |
// Put setup code here. This method is called before the invocation of each test method in the class. | |
} | |