preparation for swift 6

This commit is contained in:
neon443
2025-06-23 18:23:18 +01:00
parent be68c44ffe
commit 4629d4f75f
2 changed files with 2 additions and 54 deletions

View File

@@ -496,6 +496,7 @@ func getBuildID() -> String {
return "\(build)" return "\(build)"
} }
@MainActor
func getDevice() -> (sf: String, label: String) { func getDevice() -> (sf: String, label: String) {
#if canImport(UIKit) #if canImport(UIKit)
let asi = ProcessInfo().isiOSAppOnMac let asi = ProcessInfo().isiOSAppOnMac
@@ -513,57 +514,3 @@ func getDevice() -> (sf: String, label: String) {
return (sf: "desktopcomputer", label: "Mac") return (sf: "desktopcomputer", label: "Mac")
#endif #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()
}
}

View File

@@ -38,6 +38,7 @@ class SettingsViewModel: ObservableObject {
@Published var device: (sf: String, label: String) @Published var device: (sf: String, label: String)
@MainActor
init(load: Bool = true) { init(load: Bool = true) {
self.device = getDevice() self.device = getDevice()
if load { if load {