Hide NSTouchBar button

120 Views Asked by At

I'm working on a personal project in swift (for macOS app) and I want to make a NSbutton (Touch Bar button) and hide it.
Is there a possible way to do this?

1

There are 1 best solutions below

0
On BEST ANSWER

I found the answer!
Just write:

<button_name>.isHidden = true

or if you want to disable and not hide:

<button_name>.isEnabled = false

In my case I had button that called "submitButton" so I wrote:

submitButton.isHidden = true

and when I wanted it to appear I wrote:

submitButton.isHidden = false