My standalone watchOS app is trying to read from the calendar via EventKit
. It seems to only see local calendars though, not any of my iCloud calendars. Do I have to do something special to be able to view the iCloud based calendars?
Can EventKit not read iCloud calendar on watch?
@Gargoyle Have you ever found out what the problem is? I am having the same problem. Example code see here:
import SwiftUI
import EventKit
struct ContentView: View {
let eventStore = EKEventStore()
@State var success: Bool = false
@State var calendarNames: [String] = [String]()
func request() async {
success = (try? await eventStore.requestFullAccessToEvents()) ?? false
}
func list() {
calendarNames = eventStore.calendars(for: .event).map { $0.title }
}
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Access: \(success.description)")
ScrollView {
ForEach(calendarNames, id: \.self) { name in
Text(name)
}
}
}
.onAppear {
Task {
await request()
list()
}
}
.padding()
}
}