From 4629d4f75f2bf5ab4d57a0a826587da0c418acb7 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Mon, 23 Jun 2025 18:23:18 +0100 Subject: [PATCH] preparation for swift 6 --- Shared/Model/Events.swift | 55 +------------------------------------ Shared/Model/Settings.swift | 1 + 2 files changed, 2 insertions(+), 54 deletions(-) diff --git a/Shared/Model/Events.swift b/Shared/Model/Events.swift index 40ad64c..0d9835d 100644 --- a/Shared/Model/Events.swift +++ b/Shared/Model/Events.swift @@ -496,6 +496,7 @@ func getBuildID() -> String { return "\(build)" } +@MainActor func getDevice() -> (sf: String, label: String) { #if canImport(UIKit) let asi = ProcessInfo().isiOSAppOnMac @@ -513,57 +514,3 @@ func getDevice() -> (sf: String, label: String) { return (sf: "desktopcomputer", label: "Mac") #endif } - -extension Event: AppEntity { - static let defaultQuery = EventQuery() - - static var typeDisplayRepresentation: TypeDisplayRepresentation { - TypeDisplayRepresentation("skdfj") - } - - var displayRepresentation: DisplayRepresentation { - DisplayRepresentation("eventsss") - } -} - -struct EventQuery: EntityQuery, DynamicOptionsProvider { - typealias Entity = Event - @Dependency var vm: EventViewModel - func results() async throws -> some ResultsCollection { - return vm.events - } - // func defaultResult() async -> DefaultValue? { - // return vm.events[0] - // } - func entities(for identifiers: [Entity.ID]) async throws -> [Entity] { - return vm.events - } - func suggestedEntities() async throws -> some ResultsCollection { - return vm.events //lol cba - } -} - -struct CompleteEvent: AppIntent { - static var title: LocalizedStringResource = "Complete An Event" - static var description = IntentDescription("Mark an Event as complete.") - - @Parameter(title: "Event ID") - var eventID: String - - func perform() async throws -> some IntentResult { - print("s") - let viewModel = EventViewModel() - print("hip") - guard let eventUUID = UUID(uuidString: eventID) else { - print(":sdklfajk") - return .result() - } - print("hii") - if let eventToModify = viewModel.events.firstIndex(where: { $0.id == eventUUID }) { - print("hiii") - viewModel.events[eventToModify].complete = true - viewModel.saveEvents() - } - return .result() - } -} diff --git a/Shared/Model/Settings.swift b/Shared/Model/Settings.swift index a01d61d..f5a0939 100644 --- a/Shared/Model/Settings.swift +++ b/Shared/Model/Settings.swift @@ -38,6 +38,7 @@ class SettingsViewModel: ObservableObject { @Published var device: (sf: String, label: String) + @MainActor init(load: Bool = true) { self.device = getDevice() if load {