From cb77b82737645c01fc7c1a4a037f6ba910dc4a01 Mon Sep 17 00:00:00 2001 From: Pierluigi Cifani Date: Wed, 30 Oct 2024 15:01:41 +0100 Subject: [PATCH 1/2] Migrate to @Entry --- .../SwiftUI/Views/AsyncButton.swift | 20 ++----------------- .../SwiftUI/Views/AsyncView.swift | 9 +-------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/Sources/BSWInterfaceKit/SwiftUI/Views/AsyncButton.swift b/Sources/BSWInterfaceKit/SwiftUI/Views/AsyncButton.swift index b65f0721..27eedf09 100644 --- a/Sources/BSWInterfaceKit/SwiftUI/Views/AsyncButton.swift +++ b/Sources/BSWInterfaceKit/SwiftUI/Views/AsyncButton.swift @@ -240,25 +240,9 @@ public extension View { } } -private struct AsyncButtonLoadingStyleEnvironmentKey: EnvironmentKey { - static let defaultValue: AsyncButtonLoadingConfiguration = .init() -} - -private struct AsyncButtonOperationIdentifierKey: EnvironmentKey { - static let defaultValue: String? = nil -} - private extension EnvironmentValues { - - var asyncButtonLoadingConfiguration: AsyncButtonLoadingConfiguration { - get { self[AsyncButtonLoadingStyleEnvironmentKey.self] } - set { self[AsyncButtonLoadingStyleEnvironmentKey.self] = newValue } - } - - var asyncButtonOperationIdentifierKey: String? { - get { self[AsyncButtonOperationIdentifierKey.self] } - set { self[AsyncButtonOperationIdentifierKey.self] = newValue } - } + @Entry var asyncButtonLoadingConfiguration = AsyncButtonLoadingConfiguration() + @Entry var asyncButtonOperationIdentifierKey: String? = nil } private extension Swift.Result where Failure == Error { diff --git a/Sources/BSWInterfaceKit/SwiftUI/Views/AsyncView.swift b/Sources/BSWInterfaceKit/SwiftUI/Views/AsyncView.swift index dffd061e..c6a4fc13 100644 --- a/Sources/BSWInterfaceKit/SwiftUI/Views/AsyncView.swift +++ b/Sources/BSWInterfaceKit/SwiftUI/Views/AsyncView.swift @@ -320,15 +320,8 @@ public extension View { } } -private struct DebounceOperationForMilliseconds: EnvironmentKey { - static let defaultValue: Double? = nil -} - private extension EnvironmentValues { - var debounceOperationForMilliseconds: Double? { - get { self[DebounceOperationForMilliseconds.self] } - set { self[DebounceOperationForMilliseconds.self] = newValue } - } + @Entry var debounceOperationForMilliseconds: Double? = nil } private extension AsyncView.Operation { From 434ff16941fc450ae8fcf27fad0b7edd76fda017 Mon Sep 17 00:00:00 2001 From: Pierluigi Cifani Date: Wed, 30 Oct 2024 15:03:30 +0100 Subject: [PATCH 2/2] Update swift.yml --- .github/workflows/swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 080708a7..8838d12b 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -13,6 +13,6 @@ jobs: with: lfs: true - name: Test BSWInterfaceKit iOS - run: set -o pipefail && xcodebuild -scheme BSWInterfaceKit -destination "platform=iOS Simulator,name=iPhone 16,OS=18.0" test | xcbeautify --renderer github-actions + run: set -o pipefail && xcodebuild -scheme BSWInterfaceKit -destination "platform=iOS Simulator,name=iPhone 16,OS=18.1" test | xcbeautify --renderer github-actions - name: Build BSWInterfaceKit macOS run: set -o pipefail && swift build | xcbeautify --renderer github-actions