sindresorhus / Settings

⚙ Add a settings window to your macOS app in minutes
MIT License
1.45k stars 100 forks source link

Add non-uniform segment sizing switch #47

Closed DivineDominion closed 4 years ago

DivineDominion commented 4 years ago

This changes PreferencesStyle.segmentedControl to get an associated value:

public enum PreferencesStyle {
    public enum SegmentSize {
        case fit, uniform
    }

    case toolbarItems
    case segmentedControl(size: SegmentSize)
}

With that, you can opt in to not use the widest segmented control size for all segments. I still think the uniform sizing looks best for 2 or 3 segments. But when you have more than 4 panes, the names and large insets become a problem and require very wide windows.

Uniform (old) Fitting (new)
Screenshot 2020-02-20 at 18 59 28 Screenshot 2020-02-20 at 18 59 58
sindresorhus commented 4 years ago

Good idea. Can you update the readme too? Maybe include the above comparison table and mention when you would use each style.

sindresorhus commented 4 years ago

@DivineDominion Friendly bump. In case you missed my comments :)

DivineDominion commented 4 years ago

I wanted to jump in and implement .fitSmall, but cannot help out with this repo for a while until I get a device with Catalina. That's unfortunate :)

image

sindresorhus commented 4 years ago

but cannot help out with this repo for a while until I get a device with Catalina. That's unfortunate :)

I increased the required Xcode version as I thought that Xcode version was required to compile the latest Swift syntax. I've tried decreasing it here: https://github.com/sindresorhus/Preferences/pull/47/commits/c79a490cf4a1c992e15d75b7ab9bf70464a2ba41 Not sure you'll be able to compile though.

DivineDominion commented 4 years ago

I won't have time to work on app components until much later this year. What's your plan with this going forward?

sindresorhus commented 4 years ago

I moved it to an issue in case anyone else wants to work on it sooner: https://github.com/sindresorhus/Preferences/issues/62