Please help with: Trailing closure passed to parameter of type 'EKEvent?' that does not accept a closure

I use this function to read calendar headers in a array of strings:

`func getCalendarHeaders(ofType: EKEntityType, alerter: Alerter) async -> [String] {
        var headers: [String] = []
        do {
            if try await requestAuthorizationFor(ofType) {
                let calendars = try await fetchCalendars(ofType: ofType)
                for calendar in calendars {
                    headers.append(calendar.title)
                }
            }
        } catch let error {
            DispatchQueue.main.async {
                alerter.alert = ErrorManager.shared.showAlert(error: error)
            }
        }
        return headers
    }

In my view model / or view I try to init with:

Task {
            self.eventCalendarHeaders = await CalendarManager.shared.getCalendarHeaders(ofType: EKEntityType.event, alerter: alerter) 
        }

Why I get this error?

Trailing closure passed to parameter of type 'EKEvent?' that does not accept a closure

  • Where exactly do you get the error ?

Add a Comment