Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement custom icon #10

Open
Yetispapa opened this issue Aug 21, 2017 · 4 comments
Open

Implement custom icon #10

Yetispapa opened this issue Aug 21, 2017 · 4 comments

Comments

@Yetispapa
Copy link

Yetispapa commented Aug 21, 2017

I'm currently implementing QuickActions with your framework. I want to set custom icons for the quick actions but I don't really know how exactly. In your source there's the following line:

if self == .custom {
            NSException(name: NSExceptionName(rawValue: "Invalid option"), reason: "`Custom` type need to be used with `toApplicationShortcutIcon:imageName`", userInfo: nil).raise()
            return nil
        }

To build the shortcuts my code looks like in your example:

let shortcuts = [
            Shortcut(
                type: AppShortcut.createExpense,
                title: NSLocalizedString("CreateExpenseTitle", comment: ""),
                subtitle: NSLocalizedString("CreateExpenseSubTitle", comment: ""),
                icon: .add
            )
        ]

There's this function:

func toApplicationShortcutIcon(_ imageName: String) -> UIApplicationShortcutIcon?

But I don't really know how to call this function or is there another way? Can someone give me an advice how to implement a custom icon?

@ricardopereira
Copy link
Owner

@Yetispapa Unfortunately, a custom icon isn't available with the latest version.

I want to implement it like icon: .custom(imageName: "my-icon") but it's not ready. Sorry.

@Yetispapa
Copy link
Author

Ok. Thanks for your quick answer. When do think is the feature ready?

@neoighodaro
Copy link

Any word on this?

@ricardopereira
Copy link
Owner

@neoighodaro Sorry, I didn't have the time to implement that. Feel free to open a PR for it. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants