【发布时间】:2021-10-26 07:23:45
【问题描述】:
我想从 EKEvent 获取日历颜色。但我得到了错误: 编译器无法在合理的时间内对该表达式进行类型检查;尝试将表达式分解为不同的子表达式 Rectangle().fill 导致错误。 如何从 calendar.cgcolor 中获取 Rectangle 的 UIColor?
ForEach(0..<data.eventsByDay.prefix(4).count)
{(section) in
HStack(alignment: .bottom){
ForEach(0..<data.eventsByDay[section].prefix(3).count)
{(row) in
Rectangle().fill(UIColor(cgcgolor: data.eventsByDay[section][row].calendar.cgcolor))
.frame(width: 3, height: 26, alignment: .leading)
.cornerRadius(1.5)
.padding(.bottom, 1.0)
}
}
【问题讨论】: