Skip to content

Three beautiful macOS sidebars. Two built in Cocoa, and the third in SwiftUI.

License

Notifications You must be signed in to change notification settings

revblaze/SimpleSidebar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

About

Three beautiful macOS sidebars. Two built in Cocoa, and the third in SwiftUI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages