It's all about Tab's

December 31, 2019 · 2 min read

I have been trying to add a settings panel to my MetaMaker macOS application, everything I tried always opened a new window rather than replacing the current window content.

It turns out that I needed to think different. Thanks to a member of the iOS Folks Slack channel, they pointed me to using tabbed based content without a tab navigator.

This allows me to switch content tabs in code, but without the need to show a tab navigation bar. This was a huge shift in my thinking and greatly appreciated.

In the screenshot below I have highlighted the tab section in red and each tab in Green.

To switch between the tabs in code, I created two simple functions that use the tab index to identify which I want displayed.

    // MARK: Menu Items
    @IBAction func showSettingsWindow(_ sender: Any) {
        tabContainer.selectTabViewItem(at: 1)
    }

    @IBAction func showPostCreatorWindow(_ sender: Any) {
        tabContainer.selectTabViewItem(at: 0)
    }

With that all in place, it just works rather nicely.




Peter Witham
Peter Witham

Web and Mobile Software Maker, Photographer and Podcaster. I live and breath creativity.
I'd love for you to connect with me via Twitter or if you are a photo person like myself, Instagram.



Related Reads
03-27-2020 Live Stream Highlights

I needed to fix a bug where inserting a pre-coded string was not respecting the attributed string di...


March 28, 2020 · 1 min read

Related Reads
Podcast Season 1 Episode 20 - iPad gets a cursor

It happened, maybe it was inevitable despite Apple’s best effort to say we don’t need it. But the iP...


March 23, 2020 · 1 min read

Related Reads
How to use GitHub with Xcode 11

Xcode 11 and GitHub have come a long way in their relationship, we can now work directly with GitHub...


March 22, 2020 · 1 min read

Related Reads
Live Stream Recording - macOS App Development

As I continue to work on my application I created for personal use, I have a bug that I need to reso...


March 21, 2020 · 1 min read

Related Reads
Using SF Symbols in macOS Applications

SF Symbols is a great library, but it does not play well currently with macOS development. So here i...


March 19, 2020 · 1 min read

Related Reads
Setting NSTextView Font Size Using Swift

When setting the font size of an NSTextView things can get a bit weird with the Attributes Inspector...


March 18, 2020 · 2 min read