Settings

⚙ Add a settings window to your macOS app in minutes

MIT License

Stars
1.4K
Committers
17

Bot releases are hidden (Show)

Settings -

Published by sindresorhus over 5 years ago

Fixes

Settings -

Published by sindresorhus over 5 years ago

The main feature of this release is a segmented control style. We have also considerably improved the API and codebase.

Breaking

  • The Preferenceable protocol was renamed to PreferencePane
  • The required toolbarItemTitle property was renamed to preferencePaneTitle
  • You now have to provide a preferencePaneIdentifier property in your view controller
  • Remove .hideWindow() in favor of NSWindowController#close() (#21) d9ad07c
  • The PreferencesWindowController viewControllers parameter was renamed to preferencePanes
  • The .showWindow() method was renamed to .show() and you can now optionally pass in which preference pane to show

Migrating a view controller:

+extension PreferencePane.Identifier {
+	static let general = Identifier("general")
+}

-final class GeneralPreferenceViewController: NSViewController, Preferenceable {
+final class GeneralPreferenceViewController: NSViewController, PreferencePane {
+	let preferencePaneIdentifier = PreferencePane.Identifier.general
-	let toolbarItemTitle = "General"
+	let preferencePaneTitle = "General"
 	let toolbarItemIcon = NSImage(named: NSImage.preferencesGeneralName)!
 	// …

Enhancements

  • Add segmented control style (#6) 3b62df8 (See the readme for example)
  • Use the preference pane title as window title (#19) 891d9df
    To better align with the macOS Human Interface Guidelines.
  • Restore active preference when reopening window (#26) 2bb3fc7
  • Add option to hide the toolbar when there's one or less items (#25) 27f4b3e
  • Upgrade to Swift 5 e0ef252

Known issues

  • It doesn't show the Preferences window if you're not using auto-layout for your view controllers. It's being worked on in #28. Temporary workaround.
  • It doesn't correctly localize the window title when there's only one tab. It's being worked on in #24.

Meta

  • Welcome @DivineDominion as a maintainer 🎉
Settings -

Published by sindresorhus almost 6 years ago