david-swift / SettingsKit-macOS

Add a settings window to a SwiftUI macOS app
https://david-swift.github.io/SettingsKit-macOS/
MIT License
87 stars 2 forks source link

Support Divider, Section and custom Image as icon #14

Open longseespace opened 3 months ago

longseespace commented 3 months ago

Is your feature request related to a problem? Please describe.

Make the setting sidebar look more appealing

Describe the solution you'd like

Currently the sidebar only allows SFSymbol as icon. Is it possible to use a custom Image for this. This is useful in the case where I need to use a brand image like logo and so on.

Also it would be great if I could render Divider & Section inside the list so it's easier to navigate / look up.

Describe alternatives you've considered

I'm not sure yet. I guess supporting Divider & Section would be simple but I have no idea.

Additional context

CleanShot 2024-06-04 at 14 36 47@2x

longseespace commented 1 month ago

I know you're busy @david-swift. Any idea which files I should take a look to implement this feature? Thanks

david-swift commented 1 month ago

Sorry for ignoring this feature request for so long. I dropped the integration with SFSafeSymbols and moved to a more standard SwiftUI approach allowing all icons to be used in https://github.com/david-swift/SettingsKit-macOS/commit/e911df4ff3d60419defb168eba1c8f89e04aaccd, but I have not implemented dividers and sections yet.

Unfortunately, as I'm more of a Linux than a macOS user now and don't really use SwiftUI, I've decided not to work actively on this project anymore. I will review PRs and answer questions, but I won't implement features myself. I want to focus on cross-platform or Linux-specific projects (and school). Thanks for your understanding!

Any idea which files I should take a look to implement this feature?

What I think might be a solution is to add an additional layer of UI elements (next to tabs and subtabs) to the library:

SettingsTab(/*...*/) {
    Section(/*...*/) {
        SettingsSubtab(/*...*/) {
            /*...*/
        }
    }
}

You could still support the old initializer of SettingsTab for convenience (wrapping the content automatically with one section):

SettingsTab(/*...*/) {
    SettingsSubtab(/*...*/) {
        /*...*/
    }
}

I would create a new type similar to SettingsSubtab or SettingsTab and change SettingsTab to hold the new type.

You would also have to change the lists here to iterate over the sections (providing a section for each) and the sections to iterate over the subtabs.

If you face problems during the process, I'm happy to help!