Skip to content

Commit

Permalink
Fixed build with Xcode 16 beta 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean151 committed Jul 9, 2024
1 parent f65d40a commit e53c080
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Sources/RuleKit/Center.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,24 @@ public final class RuleKit {
}

func donations(for event: Event) async -> Event.Donations {
(try? await store.donations(for: event)) ?? .empty
(try? store.donations(for: event)) ?? .empty
}

func lastTrigger(for trigger: any Trigger) async -> Date? {
try? await store.lastTrigger(of: trigger)
try? store.lastTrigger(of: trigger)
}

func donate(_ event: Event) async {
do {
let previous = try await store.donations(for: event)
let previous = try store.donations(for: event)
// Must implement first since it might be used twice (and result having different dates)
let donation = Event.Donation.now
let donations = Event.Donations(
count: previous.count + 1,
first: previous.first ?? donation,
last: donation
)
try await store.persist(donations, for: event)
try store.persist(donations, for: event)
try await triggerFulfilledRules()
} catch {
logger.error("Donation failed for event \(event.rawValue) with error: \(error)")
Expand All @@ -99,7 +99,7 @@ public final class RuleKit {

func reset(_ event: Event) async {
do {
try await store.persist(.empty, for: event)
try store.persist(.empty, for: event)
} catch {
logger.error("Reseting donations failed for event \(event.rawValue) with error: \(error)")
}
Expand Down
4 changes: 3 additions & 1 deletion Sources/RuleKit/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
import Foundation

extension RuleKit {
public actor Store {
@MainActor
public class Store {
enum Error: Swift.Error {
case missingGroupIdentifier
case storeAlreadyConfigured
Expand Down Expand Up @@ -68,6 +69,7 @@ extension RuleKit {
}
}

@MainActor
func createStore() throws -> Store {
var url = try self.url
url.appendPathComponent("RuleKitEvents.plist")
Expand Down

0 comments on commit e53c080

Please sign in to comment.