Hi community,
I never build a macOS application before and just getting started with Xcode.
I'm completely lost on how to implement the touchbar while using SwiftUI.
I read and tested the tutorial provided here: https://developer.apple.com/documentation/appkit/touch_bar/creating_and_customizing_the_touch_bar
But the code doesn't make sense to me. I played around about 8 hours now and I wasn't even able to make the touchbar show up with a default dummy button. The longer I experimented, the more I had the impression that this all is not SwiftUI, but I really can't tell, because I don't know the difference yet. I just want to learn the new System and don't start with outdated stuff.
Indeed, everything I found on the internet, tutoring the touchbar implementation seems to be no SwiftUI. The only thing I found is this ( https://developer.apple.com/documentation/swiftui/touchbar ) and this ( https://stackoverflow.com/questions/59919050/how-can-i-display-touch-bar-buttons-using-swiftui ).
None of these help. I don't even know where to start. It's pretty easy to add content to the default window, but thats of course not what I want.
For context: I'm trying to build an app that functions like a bridge to implement touchbar functionality to an application I'm using professionally. The app will in the end only display touchbar content and will have no window whatsoever.
Hope someone can help, I'm maximum frustrated,
Nils
Ah, I see, my last post isn't public since the code I posted is being moderated *sigh*.
BUT, I got it to work with a little hint from this guy (Vincent) in the sub-answers:
https://stackoverflow.com/questions/59919050/how-can-i-display-touch-bar-buttons-using-swiftui
"I needed to open
System Preferences
> Keyboard
> Shortcuts
and make sure 'Use keyboard navigation to move focus between controls' is checked."This really seems like it's not the way it should be like, since other Touchbar apps functioned on my machine without having to set this setting, very strange!