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

[WIP] SettingToggle Icon Support +Fixes #42

Open
7 tasks done
duraki opened this issue Jan 26, 2025 · 2 comments
Open
7 tasks done

[WIP] SettingToggle Icon Support +Fixes #42

duraki opened this issue Jan 26, 2025 · 2 comments

Comments

@duraki
Copy link

duraki commented Jan 26, 2025

This is separate issue for tracking _original feature request in #24. There are few PR on this (ie. #38, #37) but both of them has issues due to not implementing nillable horizontalPadding. This issue should track my changes featuring both PR #38 & #37, but with additional options implementing:

  • SettingToggle native support for onChange(...) event expecting closure
  • SettingToggle native icon support
  • Fixes on SettingToggle Icon padding issue (see add action to a SettingToggle control #38 (comment))
    • SettingToggle support for nillable horizontalPadding
    • SettingToggle support for optional edgePadding
  • SettingToggle Icon via extension (as expected, ie. what SettingButton currently implements)
  • Example usage of SettingToggle with custom Icon

Feature Showcase

Image

duraki added a commit to When-original-devs-wont-merge-good-PRs/Setting that referenced this issue Jan 26, 2025
…sue via nillable horizontalPadding _ref aheze#42

This update fixes SettingToggle implementing Icons among other functionality (ref. aheze#42)

- impl: edgePadding setter (optional) via env_var, otherwise uses horizontalPadding (default)
- fixes: Icon padding issue (ref  via nillable horizontalPadding (ref. [aheze/Setting/#2614139662](aheze#38 (comment))), covering aheze#38, aheze#37
- impl: SettingToggle extension supporting `.icon(...)` methods
duraki added a commit to When-original-devs-wont-merge-good-PRs/Setting that referenced this issue Jan 26, 2025
…sue via nillable horizontalPadding _ref aheze#42

This update fixes SettingToggle implementing Icons among other functionality

- impl: edgePadding setter (optional) via env_var, otherwise uses horizontalPadding (default)
- fixes: Icon padding issue (ref  via nillable horizontalPadding (ref. aheze#38 (comment), covers aheze#38, aheze#37
- impl: SettingToggle extension supporting `.icon(...)` methods
- impl: SettingToggle `onChange(...)` event handler, triggering when toggle is switched on/off
@duraki
Copy link
Author

duraki commented Jan 26, 2025

Preview provided via:

// SettingExample/PreferencesView.swift

struct PreferencesViews_Previews: PreviewProvider {
    static var previews: some View {
        PreferencesView()
    }
}

duraki added a commit to When-original-devs-wont-merge-good-PRs/Setting that referenced this issue Jan 26, 2025
…ngToggle w. Icon + onChange(...) event _ref aheze#42

This change updates the Setting/SettingExample/PreferencesView showing how to use added icon support on SettingToggle, alongside the sample code which tracks toggle switch events and trigger onChange handler via closure

Added Toggle switch example is rendered in "Extras" SettingGroup in "Preferences" tab:
- SettingToggle `toggleIcon` (bool-based @AppStorage bindings)
- SettingToggle `.icon(...)` example
- SettingToggle `onChange(...)` example

@duraki via _ref aheze#42
@duraki
Copy link
Author

duraki commented Jan 26, 2025

Hey @aheze, hope this small contrib helps you a bit. Thanks for open-sourcing and writing this package, really nice to use. I can't request MR for some reason, but the PR #43 implements this feature. I've tried to follow yours/repository codebase expectations as per previous pull requests and your commits.

Cheers 🎉

duraki added a commit to When-original-devs-wont-merge-good-PRs/Setting that referenced this issue Jan 26, 2025
…menu` _ref aheze#44

This small PR fixes bug in aheze#44 where the icon is not showing in SettingPicker component, when used in combination with `Setting.ChoicesConfiguration(pickerDisplayMode: .menu, ....)`:

- Preappends `SettingIconView(...)` when using `.menu` picker's display mode
- Requires merge of base PR @ aheze#43 & aheze#42 or cherry-picking
duraki added a commit to When-original-devs-wont-merge-good-PRs/Setting that referenced this issue Jan 26, 2025
This feature implements icon support in SettingText and SettingTextField, following the _ ext ref: aheze#42
duraki added a commit to When-original-devs-wont-merge-good-PRs/Setting that referenced this issue Jan 26, 2025
This feature implements icon support in SettingText and SettingTextField, following the _ ext ref: aheze#42

ref #1
duraki added a commit to When-original-devs-wont-merge-good-PRs/Setting that referenced this issue Jan 26, 2025
This feature implements icon support in SettingText and SettingTextField, following the _ ext ref: aheze#42

ref #2
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

1 participant