I'm having a strange issue with the ForEach in SwiftUI.
This is the issue: Unable to infer complex closure return type; add explicit type to disambiguate.
if I remove the ForEach and I use just the List, it works, but I need the ForEach because I would like to implement the .onDelete() modifier
struct SummaryItemsListView: View {
var items: [CalendarItem]
var body: some View {
List {
ForEach(items, id: \.self) { item in
// if 1 > 0 {
Text("hey")
} else {
Text("heu")
}
}
}
.foregroundColor(Color.AgendaColors.foreground)
}
}
import EventKit
typealias CalendarItem = EKCalendarItem
extension EKCalendarItem: Identifiable {
public var id: Int {
return self.hash
}
var isTodo: Bool {
return self is EKReminder
}
var isEvent: Bool {
return self is EKEvent
}
}