从Swift app打开日历

Amy*_*Amy 4 events calendar swift

如何从Swift应用程序打开日历(例如按下按钮时)?或者有没有办法在应用程序的视图控制器中嵌入日历?我想避免使用其他人编写的外部日历.谢谢!

Duy*_*Hoa 7

您可以使用网址方案打开日历应用calshow://:

guard let url = URL(string: "calshow://") else { return }
UIApplication.shared.open(url, options: [:], completionHandler: nil)
Run Code Online (Sandbox Code Playgroud)

使用EventKit,您可以实现自己的日历.您应该阅读Apple网站上的"日历和提醒编程指南".