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

Customize backgroundEffect blur styles for BackgroundEffectStyle.systemDefault #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mixdesign
Copy link

@mixdesign mixdesign commented May 26, 2024

Hey!
Thanks for great lib which we use in our Sajda app for a long time.

Sajda - is a super app for Muslims with more than 3 million MAU and 1.5 million DAU.

We faced with a small limitation in DrawerView. When I would like to set a backgroundEffect to systemDefault, for light mode I can not set it to .extraLight or some other values iOS provides!

So, this PR basically adds this customization for both dark and light modes, without changing the current behavior.

Regards.

@mixdesign mixdesign changed the title Introduce new public properties darkBlurEffectStyle and lightBlurEffe… Customize backgroundEffect blur styles for BackgroundEffectStyle.systemDefault May 26, 2024
}

/// The background blur effect style for light mode.
public var lightBlurEffectStyle: UIBlurEffect.Style = .light {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, for some reason developers may set a dark style for light mode, but, seems like we shouldn't make a limitation on it, because for some kind of Themes, developers may want to set .light for dark mode and .extraLight for light mode. You know what I mean? :)

@mkko
Copy link
Owner

mkko commented May 27, 2024

Hey, thank you for the great feedback. Also thank you chiming in on this.

I would hope to integrate the whole style using the given trait collection (user interface style, accessibility contrast). I'd be more than happy to add support for these. Unfortunately I don't have time to write a full example, but what would you think about something following:

public var backgroundEffect: (TraitCollection) -> UIVisualEffect?

This would be similar to what UIColor has. UIColor has this great UIColor(dynamicProvider: (UITraitCollection) -> UIColor>) constructor, but unfortunately UIVisualEffect doesn't, at least to my knowledge. With this dynamic provider, we could get rid of the custom BackgroundEffectStyle altogehter.

Generally I would think that people either care about the dark mode or don't. When they don't, they might skip setting the value which would lead to difficult to detect bugs in their apps. Similar to setting only a background color of a label to fixed value but not realizing that the text color is still dnyamic. WDYT?

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

Successfully merging this pull request may close these issues.

None yet

2 participants