KPCJumpBarControl 0.4.0

KPCJumpBarControl 0.4.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jul 2016
SPMSupports SPM

Maintained by Cédric Foellmi.



  • By
  • Cédric Foellmi

KPCJumpBarControl

A jump bar similar to Xcode’s allowing to easily display and navigate across a tree of objects.

Demo JumpBar

Installation

Using Carthage: add github "onekiloparsec/KPCJumpBarControl" to your Cartfile and then run carthage update.

Using CocoaPods: pod 'KPCJumpBarControl'

Usage

KPCJumpBarControl is designed for you to use only the JumpBarControl class, and fill it with a tree of object conforming to JumpBarItemProtocol. A helper class JumpBarItem is here for that, if you need one. Simply place a NSView in a storyboard or xib, where you need a jump bar, change its class to JumpBarControl and that’s it. To react when the jumbpar selection change, implement the JumpBarControlDelegate methods.

For instance:

    let rootSegment = JumpBarItem.item(withTitle:"level 0", icon:NSImage(named:"Oval"))
    let segment1Item0 = JumpBarItem.item(withTitle:"level 1.0", icon:NSImage(named:"Polygon"))
    let segment1Item1 = JumpBarItem.item(withTitle:"level 1.1", icon:NSImage(named:"Rectangle"))

    rootSegment.children = [segment1Item0, segment1Item1]

    self.jumpBar?.useItemsTree([rootSegment])
    self.jumpBar?.delegate = self

Highlighting

The jump bar control support the possibility to be highlighted. This is useful when you have multiple subviews, each with jump bars, and you need to indicate to the user which subview is actually ‘active’. (In the screenshot above, the upper bar has a darker background than the lower ones).

Author

Cédric Foellmi (@onekiloparsec)

LICENSE & NOTES

KPCJumpBarControl is licensed under the MIT license and hosted on GitHub at https://github.com/onekiloparsec/KPCJumpBarControl/ Fork the project and feel free to send pull requests with your changes!