Skip to content

Commit

Permalink
Merge pull request #11 from diamirio/swift-6-fixes
Browse files Browse the repository at this point in the history
Fix Swift 6 warnings
  • Loading branch information
kaulex99 authored Nov 21, 2024
2 parents 1f41856 + 6c95504 commit 3229ec7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Example/AsyncReactorExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down Expand Up @@ -416,6 +417,7 @@
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,14 @@ class RepositorySearchReactor: AsyncReactor {
@Published
private(set) var state: State

@MainActor
init(state: State = State()) {
self.state = state

let sortBy = UserDefaults.standard.string(forKey: "sortBy") ?? SortOptions.watchers.rawValue
self.handleSortOption(sortBy)

lifecycleTask {
for await _ in await NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification).values {
for await _ in NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification).values {
await self.action(.load)
}

Expand Down Expand Up @@ -110,7 +109,6 @@ class RepositorySearchReactor: AsyncReactor {
}
}

@MainActor
private func handleSortOption(_ value: String) {
state.sortBy = SortOptions(rawValue: value)!
}
Expand Down
4 changes: 1 addition & 3 deletions Sources/AsyncReactor/AsyncReactor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@

import Foundation

@MainActor
@dynamicMemberLookup
public protocol AsyncReactor: ObservableObject {
associatedtype Action
associatedtype SyncAction = Never
associatedtype State

@MainActor
var state: State { get }

@MainActor
func action(_ action: Action) async

@MainActor
func action(_ action: SyncAction)

subscript<Value>(dynamicMember keyPath: KeyPath<State, Value>) -> Value { get }
Expand Down

0 comments on commit 3229ec7

Please sign in to comment.