Latest 0.1.1
Homepage https://github.com/glenmax-ltd/GLXMacDrawerController
License MIT
Platforms osx 10.11, requires ARC
Frameworks Cocoa
Authors

CocoaPods license MIT Carthage compatible

Description

  • Written in Swift.
  • Auto layout based.
  • Supports both layer backed and non-layer backed views.
  • Supports instantiation via storyboards.
  • Still a work in progress so new features are coming very soon. Contributions are welcome.

Installation

Carthage

Add
github "glenmax-ltd/GLXMacDrawerController"
to your Cartfile.

CocoaPods

Add
pod 'GLXMacDrawerController'
to your Podfile.

Manual

Drag GLXMacDrawerController.swift into your Xcode project.

Initialisation

Storyboards

Step 1

Add 3 new NSViewController scenes to your storyboard.

Step 2

Change the class of the first view controller to GLXMacDrawerController

Step 3

Ctrl-drag from the GLXMacDrawerController to the other two view controllers (one at a time). When prompted, select ‘Custom’ for the segue type.

Step 4

Now select the created segues and ensure that they have an identifier of "center_controller" for the center controller and "left_controller" for the left controller.

That’s it! You are now good to go ;)

Programatically

If you prefer to instantiate a drawer controller yourself you can use a convenience initialiser init(leftController:,centerController:). Alternatively, you can use any other NSViewController initialisers and then set left and center view controllers yourself.

Usage

Drawer controller adds a computed property to the NSViewController which lets you access it.

To open a drawer call self.drawer?.open(animated:). To close it call self.drawer?.close(animated:).

By default sibling NSViews are transparent and expose the contents of the views behind them. This is clearly not a desired behaviour. To prevent it, center view controller is placed inside of NSBox. Its background color can be changed via the self.drawer?.centerViewBackgroundColor property.

Latest podspec

{
    "name": "GLXMacDrawerController",
    "version": "0.1.1",
    "summary": "Custom drawer controller for macOS 10.11 and above.",
    "description": "Written in Swift.nSupports both layer backed and non-layer backed views.nSupports instantiation via storyboards.nStill a work in progress so new features are coming very soon. Contributions are welcome.",
    "homepage": "https://github.com/glenmax-ltd/GLXMacDrawerController",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": {
        "Glenmax": "[email protected]"
    },
    "platforms": {
        "osx": "10.11"
    },
    "source": {
        "git": "https://github.com/glenmax-ltd/GLXMacDrawerController.git",
        "branch": "master",
        "tag": "v0.1.1"
    },
    "source_files": "GLXMacDrawerController/*.swift",
    "requires_arc": true,
    "frameworks": "Cocoa",
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3"
    },
    "pushed_with_swift_version": "3"
}

Pin It on Pinterest

Share This