Posts

Post marked as solved
2 Replies
1.7k Views
I am using storyboards for a Mac OS X programs and have a Tab View Controller. When the Tab View Controller is segued onto to screen I would like to do some setup on each of the view controllers for the tabs.The documentation for the NSTabViewController states: "Each tab is represented by an NSTabViewItem object, which contains the name of the tab and stores a pointer to the child view controller that manages the tab’s content."This is exactly what I want - "a pointer to the child view controller that manages the tab’s content." Great!But no so great -- there is no variable or method in NSTabViewItem that gives me a pointer to a view controller!! I find this very confusing. I have scanned the documentation of NSTabViewItem from top to bottom, plus looked that the header file. There is no mention of a "pointer to the child view controller" anywhere!The documentation clearly states that this pointer is there - but I can't find it. Am I missing something obvious?Thanks.
Posted
by Sedawk.
Last updated
.
Post not yet marked as solved
3 Replies
945 Views
I have been looking through all the Apple Documentation for a Guide to developing MacOS Application via Swift. For example, there is an excellent reference "Develop in Swift: Fundamentals" - but it is completely iOS/UIKit focused. While there are some notes and tutorials - there are no up-to-date guides for MacOS Development using AppKit or any other frameworks. There is just a simple list of APIs at https://developer.apple.com/documentation/appkit. The series of books above are for iOS/UIKit only. How does one start to learn MacOS Application development with the documentation that is provided? There are a few random tutorials, but nothing like the documentation written for iOs. It seems that Apple doesn't want you coding Mac Applications - but rather iOS Apps instead. Also - I am confused on which path to head down : SwiftUI or Appkit. It seems that SwiftUI is the future - but the information about using SwiftUI on MacOS is even less! It feels like to learn Mac Development I NEED to learn iOS development - starting with UIKit and then learning SwiftUI. This seems like such a waste of time - I would rather just start to learn MacOS programming. It would be brilliant if there was a "Develop in Swift: Fundamentals" for MacOS - but it seems like they don't want to spend the effort to teach MacOS Development. Maybe MacOS won't be around for the long term - but having the ability to quickly develop some custom Mac Applications would help me in the short term.
Posted
by Sedawk.
Last updated
.
Post not yet marked as solved
2 Replies
1.9k Views
I know this can't be the case, but this is driving me crazy.I am using latest version of Swift and Storyboards. To illustrate the point I created a basic project with a NSTabViewController and two view controllers. The tab of the first view controller is selected in the Storyboard. Without subclassing the little program works fine, showing the first tab and allowing you to switch back and forth.I have created a subclass of NSTabViewController and it looks like this:class TabViewControl: NSTabViewController { @IBOutlet weak var theFirstTab: NSTabViewItem! override func viewDidLoad() { super.viewDidLoad() let theTabView = theFirstTab.tabView theTabView?.selectTabViewItemAtIndex(1) } }All I want to do is automatically select the second tab when the view is loaded (in my acutal program I may want to select any one of the tabs to be presented to the user depending on the context in which the tab view controller was segued to).I have linked the first NSTabViewItem to an IBOutlet. From that I get the NSTabView and then simply select the second tab. Here is the result:http://sedawk.com/first.pngThe view from the Second Tab is shown when the program starts (even though the first tab is selected in IB), but the tabs are messed up and shows the First Tab highlighed. Clicking "First Tab" does nothing - probably because it thinks it is already selected. You must select "Second Tab" and then "First Tab" again to get everything back in order.Note that you set the same broken results (just reversed) when you select the second tab in IB and runtheTabView?.selectFirstTabViewItem(self)http://sedawk.com/second.pngIs this a bug?
Posted
by Sedawk.
Last updated
.