The SwiftUI sidebar implementation is courtesy of 1998code. Go show them some love!
Overview
Provided in this project are three different implementations of the macOS sidebar:
Variant | Compatibility |
---|---|
Cocoa
|
OS X 10.11 and higher |
SwiftUI
|
macOS 11.0 and higher |
As much as I love SwiftUI, this project is more of a POC that Cocoa is still relevant. I wanted to show that the Cocoa implementation of something as simple as a sidebar didn't need to be extremely complex or time-consuming. Similarily, creating a highly-customizable sidebar shouldn't require heavily packaged frameworks.
Variant 1 Cocoa
The variant that was built with the average programmer in-mind.
Pros | Cons |
---|---|
|
|
Summary
Great for implementing basic sidebars that don't need a ton of customization. Adopts the style of the user's version of macOS for complete immersion with backward-compatibility.
Variant 2 Cocoa
The variant that was built for designers who love Storyboards.
Pros | Cons |
---|---|
|
|
Summary
Great for maximum customization. Maintains the same style and appearance, regardless of the user's macOS version (bring newer UI design standards to backwards compatible applications)!
I do intend on making a Swift package with zero external assets required – aside from the menu icons – and would love some help getting started!
Although SwiftUI has made it a breeze to implement, I've always found the process to be far more complex than it needs to be when working with Cocoa.
Since I'm constantly developing newer applications with SwiftUI – yet also maintaining older projects that require maximum OS compatibility – I thought it would be useful to have a resource that portrays both implementations.
MIT License
Copyright 2021 © Justin Bush
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.