Skip to content

Commit

Permalink
Don’t ask for instance, but rather just its protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
onekiloparsec committed Oct 21, 2018
1 parent c388928 commit c4f7f64
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion KPCJumpBarControl/JumpBarControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ open class JumpBarControl: NSControl, JumpBarSegmentControlDelegate {
self.useItemsTree(self.binding!.treeController!.arrangedRootObjects())
}

open func useItemsTree(_ itemsTree: [JumpBarItem]) {
open func useItemsTree(_ itemsTree: [JumpBarItemProtocol]) {
self.segmentControls().forEach { $0.removeFromSuperview() }

// At that stage, we do items all in one shot. Might be optimized later.
Expand Down
2 changes: 1 addition & 1 deletion KPCJumpBarControl/NSMenu+Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extension NSImage {

extension NSMenu {

static func menuWithSegmentsTree(_ segmentsTree: [JumpBarItem],
static func menuWithSegmentsTree(_ segmentsTree: [JumpBarItemProtocol],
target: AnyObject,
action: Selector) -> NSMenu {
let menu = NSMenu()
Expand Down
4 changes: 2 additions & 2 deletions KPCJumpBarControl/NSTreeController+Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import AppKit

extension NSTreeController {
func arrangedRootObjects() -> [JumpBarItem] {
func arrangedRootObjects() -> [JumpBarItemProtocol] {
guard let rootTreeNode = self.arrangedObjects as AnyObject? else {
return []
}
Expand All @@ -18,7 +18,7 @@ extension NSTreeController {
return []
}

return proxyChildren.map({ $0.representedObject as! JumpBarItem })
return proxyChildren.map({ $0.representedObject as! JumpBarItemProtocol })
}
}

0 comments on commit c4f7f64

Please sign in to comment.