MacControlCenterUI

2.0.7

SwiftUI menu builder DSL & controls that mimic macOS Control Center.
orchetect/MacControlCenterUI

What's New

2.0.7

2023-10-20T16:13:53Z
  • Added index safeguard while generating menu content
  • View inits that take both LocalizedStringKey and String now favor the localized key for string literals

Mac Control Center UI

Platforms - macOS 11+ Swift 5.3-5.9 Xcode 13-15 License: MIT

Example

A menu builder and suite of SwiftUI controls that closely mimic the feel of macOS Control Center menus.

Integrates seamlessly with Swift's new MenuBarExtra.

Both Dark and Light Mode are fully supported.

Getting Started

Swift Package Manager (SPM)

  1. Add MacControlCenterUI as a dependency using Swift Package Manager.

    • In an app project or framework, in Xcode:

      Select the menu: File → Swift Packages → Add Package Dependency...

      Enter this URL: https://github.com/orchetect/MacControlCenterUI

    • In a Swift Package, add it to the Package.swift dependencies:

      .package(url: "https://github.com/orchetect/MacControlCenterUI", from: "2.0.0")
  2. Import the library:

    import MacControlCenterUI
  3. Try the Demo example project to see all of the available controls in action.

Requirements

Minimum requirements to compile: Xcode 13 on macOS 11 Big Sur or newer.

Supports macOS 11.0+ once compiled.

Known Issues

  • Due to the lacklustre implementation of Apple's MenuBarExtra, it is currently not possible to get smooth window resize animations without a tremendous amount of work. For that reason, most MacControlCenterUI controls whose Control Center counterparts use animation will instead use safer static view size changes.
  • As an alternative to the very restrictive SettingsLink Apple introduced in macOS 14, it is recommended to use the SettingsAccess package to programmatically open the Settings scene when using a window-based MenuBarExtra. This is demonstrated in the Demo project in this repo.

Author

Coded by a bunch of 🐹 hamsters in a trenchcoat that calls itself @orchetect.

License

Licensed under the MIT license. See LICENSE for details.

Sponsoring

If you enjoy using MacControlCenterUI and want to contribute to open-source financially, GitHub sponsorship is much appreciated. Feedback and code contributions are also welcome.

Contributions

Contributions are welcome. Posting in Discussions first prior to new submitting PRs for features or modifications is encouraged.

Description

  • Swift Tools 5.3.0
View More Packages from this Author

Dependencies

Last updated: Sun Mar 24 2024 23:38:17 GMT-0900 (Hawaii-Aleutian Daylight Time)