diff --git a/Sources/Tetra/Concurrency/CoreDataStack+Concurrency.swift b/Sources/Tetra/Concurrency/CoreDataStack+Concurrency.swift index c4bf961..e552a0b 100644 --- a/Sources/Tetra/Concurrency/CoreDataStack+Concurrency.swift +++ b/Sources/Tetra/Concurrency/CoreDataStack+Concurrency.swift @@ -14,19 +14,6 @@ import CoreData @available(iOS 13.0, tvOS 13.0, macCatalyst 13.0, watchOS 6.0, macOS 10.15, *) public extension NSPersistentContainer { - @inlinable - func loadPersistent() async throws -> NSPersistentStoreDescription { - try await withUnsafeThrowingContinuation { continuation in - loadPersistentStores { - if let error = $1 { - continuation.resume(throwing: error) - } else { - continuation.resume(returning: $0) - } - } - } - } - @available(iOS, introduced: 13.0, deprecated: 15.0, renamed: "performBackgroundTask(_:)") @available(tvOS, introduced: 13.0, deprecated: 15.0, renamed: "performBackgroundTask(_:)") @available(macCatalyst, introduced: 13.0, deprecated: 15.0, renamed: "performBackgroundTask(_:)") diff --git a/Sources/Tetra/Concurrency/Dispatch+Extension.swift b/Sources/Tetra/Concurrency/Dispatch+Extension.swift index 52c701d..5f732fb 100644 --- a/Sources/Tetra/Concurrency/Dispatch+Extension.swift +++ b/Sources/Tetra/Concurrency/Dispatch+Extension.swift @@ -27,7 +27,6 @@ public extension Task where Success == Never, Failure == Never { */ @inlinable static func sleep(until wallDeadline:DispatchWallTime, tolerance:DispatchTimeInterval? = nil) async throws { - try await Task.sleep(nanoseconds: 1000) try await dispatchTimerSleep(wait: wallDeadline, leeway: tolerance) } diff --git a/Sources/Tetra/Foundation/Codable/DecodingTypeError.swift b/Sources/Tetra/Foundation/Codable/DecodingTypeError.swift deleted file mode 100644 index 0de0ec0..0000000 --- a/Sources/Tetra/Foundation/Codable/DecodingTypeError.swift +++ /dev/null @@ -1,59 +0,0 @@ -// -// DecodingTypeError.swift -// -// -// Created by pbk on 2023/01/30. -// - -import Foundation - -/// `DecodingError.typeMismatch` wrapper type to unwind stack of decoding -@usableFromInline -struct DecodingTypeError { - - @usableFromInline - let expectedType:Any.Type - @usableFromInline - let context:DecodingError.Context - - @usableFromInline - internal init(expectedType: Any.Type, context: DecodingError.Context) { - self.expectedType = expectedType - self.context = context - } - -} - -extension DecodingTypeError: LocalizedError { - - @usableFromInline - var decodingError:DecodingError { - .typeMismatch(expectedType, context) - } - - @usableFromInline - var localizedDescription:String { - decodingError.localizedDescription - } - - @usableFromInline - var errorDescription: String? { - decodingError.errorDescription - } - - @usableFromInline - var failureReason: String? { - decodingError.failureReason - } - - @usableFromInline - var helpAnchor: String? { - decodingError.helpAnchor - } - - @usableFromInline - var recoverySuggestion: String? { - decodingError.recoverySuggestion - } - -} diff --git a/Tests/TetraTests/RunLoopSchedulerTests.swift b/Tests/TetraTests/RunLoopSchedulerTests.swift index 783c7a6..24d8321 100644 --- a/Tests/TetraTests/RunLoopSchedulerTests.swift +++ b/Tests/TetraTests/RunLoopSchedulerTests.swift @@ -43,7 +43,7 @@ final class RunLoopSchedulerTests: XCTestCase { let scheduler = await RunLoopScheduler(async: (), config: .init(qos: .background)) let name = Notification.Name(UUID().uuidString) let object = NSObject() - expectation(forNotification: name, object: object, notificationCenter: .default) { notification in + let expect1 = expectation(forNotification: name, object: object, notificationCenter: .default) { notification in XCTAssertTrue(notification.userInfo?["A"] as? String == "B") return true } @@ -63,8 +63,11 @@ final class RunLoopSchedulerTests: XCTestCase { } } - await waitForExpectations(timeout: 1) - expectation(forNotification: name, object: object, notificationCenter: .default) { + await withUnsafeContinuation{ + wait(for: [expect1], timeout: 1) + $0.resume() + } + let expect2 = expectation(forNotification: name, object: object, notificationCenter: .default) { XCTAssertTrue($0.userInfo?["A"] as? String == "C") return true } @@ -75,7 +78,10 @@ final class RunLoopSchedulerTests: XCTestCase { continuation.resume() } } - await waitForExpectations(timeout: 1) + await withUnsafeContinuation{ + wait(for: [expect2], timeout: 1) + $0.resume() + } } }