Search code examples
iosswiftswift3cncontact

Unable to find UIApplicationShortcutIcon.init(contact: CNContact) for loading contact image in dynamic action


That's really weird that there is no init(contact: CNContact) inside UIApplicationShortcutIcon, this is recently released and not even deprecated.

enter image description here

There are only two options, init with type and templateImageName. Whereas when I check UIApplicationShortcutIcon api reference at Apple, it's showing it's available.

enter image description here


Solution

  • As per @OOPer comment, You need to import ContactsUI to use UIApplicationShortcutIcon.init(contact:). (Though, Apple's doc is not clear enough about it.)