我想开发一个带触摸条的应用程序.我在互联网上搜索并看到了一些教程.他们都使用windowcontroller进行演示,只需makeTouchBar()在故事板中覆盖或拖动触摸栏,然后就会有一个触摸栏.但是我想在viewcontroller中使touchbar变得不同.然后我将触摸条拖入故事板中的viewcontroller,并在viewcontroller中绑定触摸栏.

bind(#keyPath(touchBar), to: self, withKeyPath: #keyPath(touchBar), options: nil)
但是当我运行项目时,我找不到我的触摸栏,然后我打印touchbar.isVisible,我发现该值为false.

那么如何在viewcontroller中显示触摸栏.谢谢!