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

Please add extended support for SF Symbol configuration #489

Open
funnel20 opened this issue Feb 16, 2024 · 4 comments
Open

Please add extended support for SF Symbol configuration #489

funnel20 opened this issue Feb 16, 2024 · 4 comments

Comments

@funnel20
Copy link
Contributor

I'm very pleased that InAppSettingsKit version 3.6 now supports SF Symbols via systemImageNamed:.

One question though, as this opens the door to more customisation. In our apps we use even more native power with systemImageNamed:withConfiguration:.
For example to apply palette colouring on a SF Symbol:
Screenshot 2024-02-16 at 10 23 29

// Define image name and configuration:
NSString *name = @"cloud.sun";
UIImageConfiguration *config = [UIImageSymbolConfiguration configurationWithPaletteColors:@[
    [UIColor systemTealColor],      // cloud
    [UIColor systemYellowColor]     // sun
]];

// Create image:
UIImage *image = [UIImage systemImageNamed:name
                         withConfiguration:config];

Since you already use IASKCellImage as name, would it be possible to extend InAppSettingsKit with something like a IASKCellImageConfiguration, which refers to the name of Class variable of the parent ViewController (e.g. config in this example)?

The good part of systemImageNamed:withConfiguration: is that even if config is nil, it will ignore the configuration and just acts as systemImageNamed:.

Thank you for considering this improvement.

@futuretap
Copy link
Owner

This is certainly a good idea. I suggest adding a symbolImageConfiguration property to IASKAppSettingsViewController. That property would have to be copied to all child view controllers (similar to how the delegate is assigned to child VCs). Is probably easier to use, especially from Swift code.

Would you be so kind to contribute a pull request? ;-)

@funnel20
Copy link
Contributor Author

@futuretap I was hoping to apply multiple different Symbol Configurations per ViewController, as the layout might request one configuration per image.
Consider for example the native iOS Settings app, it consists of a wide range of coloured icons:

IMG_8B84F6225CA7-1

Hence my idea of a new parameter in the .plist

@futuretap
Copy link
Owner

I see. To achieve this example, you’d need a separate class for each background color. Doesn't really scale well, too.
If I were you, I'd implement the -settingsViewController:cellForSpecifier: delegate callback and set

cell.imageView.image = cell.imageView.image.withConfiguration(yourConfiguration)

Then you can switch on specifier.key to create a configuration per key. Does that work for you?

@funnel20
Copy link
Contributor Author

@futuretap That's a great idea, thank you very much.

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

No branches or pull requests

2 participants