Add custom icon to ShortCutItem in Swift

939 views Asked by At

I've searched a lot but don't find a solution for my problem...

let test = UIMutableApplicationShortcutItem(
            type: "testtype",
            localizedTitle: "Title",
            localizedSubtitle: "Subtitle",
            icon: UIApplicationShortcutIcon(type: .add),
            userInfo: nil)

My problem is that I have an image in my Assets folder and I want to use it as icon in the ShortCutItem. If you add a Shortcut in info.plist you can use UIApplicationShortcutItemIconFile to set a custom icon - how can I make that in Swift?

This doesn't work:

icon: UIApplicationShortcutItemIconFile(type: .TITLEOFIMG),

Thanks for all help!

0

There are 0 answers