Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/revblaze/SimpleSidebar
Three beautiful macOS sidebars. Two built in Cocoa, and the third in SwiftUI.
https://github.com/revblaze/SimpleSidebar
cocoa mac macos osx sidebar storyboard swift swiftui swiftui-example
Last synced: 3 months ago
JSON representation
Three beautiful macOS sidebars. Two built in Cocoa, and the third in SwiftUI.
- Host: GitHub
- URL: https://github.com/revblaze/SimpleSidebar
- Owner: revblaze
- License: mit
- Created: 2021-03-03T14:30:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-07-14T17:47:21.000Z (over 3 years ago)
- Last Synced: 2024-06-26T00:39:54.475Z (5 months ago)
- Topics: cocoa, mac, macos, osx, sidebar, storyboard, swift, swiftui, swiftui-example
- Language: Swift
- Homepage:
- Size: 103 MB
- Stars: 180
- Watchers: 5
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
The SwiftUI sidebar implementation is courtesy of [1998code](https://github.com/1998code/SwiftUI2-MacSidebar). Go show them some love!
# Overview
Provided in this project are three different implementations of the macOS sidebar:Variant
Compatibility
**Cocoa**- **Variant 1:** Built for Programmers `(NSOutlineView)`
- **Variant 2:** Built for Designers `(Storyboards)`
OS X 10.11 and higher
**SwiftUI**
- **Joint Variance:** `SideBarListStyle()`
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
```
• Fastest Cocoa implementation
• Easy to setup and configure menu items
• Resizable sidebar (NSSplitView)
• Adopts the style of the user's current
version of macOS (tbt to aqua!)
• Only assets are icons (optional)
```
```
• Lacks section & row headers
• Not very customizable
• Menu items are inherited
• All follow the same structure
ie. title & icon
```### 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
```
• Highly customizable interface
• Allows for individual menu item customization
• Same appearance across all versions of macOS
• Mutable/customizable container view
• Easy to modify, manipulate and animate
ie. Toggle hide/show sidebar with fade effect
```
```
• Heavily relies on Storyboards
• Uses AutoLayout + Constraints
• Experience with design software – ie.
Photoshop/XD – for the ultimate
customization experience
```### 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.