1
override func eventsForDate(_ date: Date) -> [EventDescriptor] {
      var models = Model.shared.appoinmentProfessional
        for model in models{
            // Create new EventView
            let event = Event()
            // Specify StartDate and EndDate
            event.startDate = model.startDate
            event.endDate = model.endDate
            // Add info: event title, subtitle, location to the array of Strings
            var info = [model.title, model.location]
            info.append("\(datePeriod.beginning!.format(with: "HH:mm")) - \(datePeriod.end!.format(with: "HH:mm"))")
            // Set "text" value of event by formatting all the information needed for display
            event.text = info.reduce("", {$0 + $1 + "\n"})
            events.append(event)
        }
        return events

    }

我是 swift 新手,不知道如何在 calendarkit 中为 json 文件中的动态事件获取数据。我已经做了我能做的一切,但对我没有任何帮助。

我是 mvc 模式的新手,所以请指导我如何使用 calendarkit 文件中的模型从儿子那里获取数据

4

0 回答 0