Skip to content

Instantly share code, notes, and snippets.

@jhoughjr
Created March 18, 2018 22:31
Show Gist options
  • Save jhoughjr/8d997db429bf29efa6158b3664210972 to your computer and use it in GitHub Desktop.
Save jhoughjr/8d997db429bf29efa6158b3664210972 to your computer and use it in GitHub Desktop.
//
// BrowserViewController.swift
// Ghostnote2
//
// Created by Jimmy Hough Jr on 3/18/18.
// Copyright © 2018 Jimmy Hough Jr. All rights reserved.
//
import Foundation
import AppKit
class BrowserViewController: NSViewController {
@IBOutlet var ghostnotesButton:NSButton!
@IBOutlet var tasksButton:NSButton!
@IBOutlet var notesButton:NSButton!
@IBOutlet var containerView:NSView!
var tabController:NSTabViewController?
var sb:NSStoryboard {
get {
return NSStoryboard(name: NSStoryboard.Name("Browser"),
bundle: Bundle.main)
}
}
@IBAction func showGhostNotes(_ sender:Any?) {
tasksButton.state = .off
notesButton.state = .off
ghostnotesButton.state = .on
tasksButton.highlight(false)
notesButton.highlight(false)
ghostnotesButton.highlight(true)
tabController?.selectedTabViewItemIndex = 0
}
@IBAction func showTasks(_ sender:Any?) {
ghostnotesButton.state = .off
notesButton.state = .off
tasksButton.state = .on
ghostnotesButton.highlight(false)
notesButton.highlight(false)
tasksButton.highlight(true)
tabController?.selectedTabViewItemIndex = 1
}
@IBAction func showNotes(_ sender:Any?) {
ghostnotesButton.state = .off
tasksButton.state = .off
notesButton.state = .on
ghostnotesButton.highlight(false)
tasksButton.highlight(false)
notesButton.highlight(true)
tabController?.selectedTabViewItemIndex = 2
}
override func prepare(for segue: NSStoryboardSegue, sender: Any?) {
if let tabVC = segue.destinationController as? NSTabViewController {
self.tabController = tabVC
let i = tabController?.selectedTabViewItemIndex
if i == 0 {
showNotes(self)
}else if i == 1 {
showTasks(self)
}else if i == 2 {
showGhostNotes(self)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment