Swiftpack.co - Package - sindresorhus/Preferences

404: Not Found


Stars: 828


Used By

Total: 0



This package is now considered stable.




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


  • 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)!
 	// …


  • 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.


  • Welcome @DivineDominion as a maintainer 🎉