Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open calendar from Swift app

How can I open a calendar from Swift app (when pressing a button for example)? Or is there a way to embed a calendar in a view controller in the app? I want to avoid using external calendars programmed by others. Thanks!

like image 719
Amy Avatar asked Apr 16 '15 19:04

Amy


1 Answers

You can open the Calendar app by using the url scheme calshow://:

Swift 3+

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

Swift 2 and below

 UIApplication.sharedApplication().openURL(NSURL(string: "calshow://")!)

With EventKit, you can implement your self a calendar. You should read Calendar and Reminders Programming Guide from Apple site.

like image 163
Duyen-Hoa Avatar answered Oct 08 '22 11:10

Duyen-Hoa