0

I´m currently playing around with an app that's creating its own touchbar layout. Only simple buttons with text that shows up.

The thing is that I have a WindowController and a ViewController. The WindowController makes the touchbar with its buttons.

But what I want to do is in the ViewController when I press a button I want the touchbar to change, like if you would update it.

So my question is, how do I from the ViewController get access to the touchbar created in the windowController?

The relation is WindowController (creating touchbar, setting 2 default buttons and showing it) -> ViewController (button to change touchbar)

Any ideas? I'm new to Mac development so please call me an idiot and give me a lead :D

Phyber
  • 1,368
  • 11
  • 25
Labba
  • 121
  • 1
  • 10
  • Getting informations from previous controller is quite tricky. What do you need 2 controllers ? If you need informations from the touchbar you probably need to fusionate your controllers on the same view. – Alain Berrier Jul 31 '17 at 13:23
  • @AlainBerrier, well if I should be honest, I don't really know. I started a MacOS project and want suggested to create a WindowController for the first View so I then could create a customized touchbar. The WindowController view don't allow me to add any buttons to it if its not a ViewController (right?). So my though was to but a button in the new ViewController that when pressed modify the original created TouchBar created by the WindowController. – Labba Jul 31 '17 at 14:14
  • Each viewController controls a view and do the actions you told him to do. You can call an other controller on your controller with the storyboard or programmatically but **accessing the variables of the previous controller is not the right think to do (and I think it's impossible).** You should create only one controller with a button that directly change the toucher – Alain Berrier Jul 31 '17 at 20:26
  • Please explain what is your intent, your goal. I'm rather sure you actually don't need two controllers just in order to achieve something with the touch bar. – Eric Aya Aug 01 '17 at 12:04

0 Answers0