macbookpro-touch-bar

macCatalyst/ SwiftUI Touch Bar

北城余情 提交于 2020-07-18 06:46:25
问题 how could I add Touch Bar Support in Catalyst- Apps written in SwiftUI? For Example, if I want to display a Button in a View: import SwiftUI struct ContentView: View { var body: some View { VStack{ #if targetEnvironment(macCatalyst) Text("macOS") .frame(maxWidth: .infinity, maxHeight: .infinity) .focusable() .touchBar { Button(action: { print("tapped") }) { Text("TestButton") } } #endif Text("iOS") } } } If I use it in a an macOS App it works but if I use it in Catalyst and add

Cannot get locationInView: for this type of NSTouch assertion error when trying to retrieve location

南笙酒味 提交于 2019-12-25 01:29:51
问题 I'm trying to retrieve the mouse location after a user clicks on a specific SCNNode. I eventually want to perform a hit test to determine which SCNNode was clicked. I have the following code but once I run the project I get an assertion error stating: "Cannot get locationInView: for this type of NSTouch". Any help would be appreciated. override func touchesBegan(with event: NSEvent) { let touch = event.touches(for: self.view) if #available(OSX 10.12.2, *) { let location = touch.first?

Is there programable access to the Control Strip of the macOS Touch Bar?

二次信任 提交于 2019-12-18 14:54:39
问题 The Control Strip is the static and global part of the macOS Touch Bar which is always visible in every context and app. While Apple provides full documentation about how to use the API to provide a contextual App Region in your macOS app, I couldn't find any notice about how to add stuff to the Control Strip . I could think of a lot of nice tools and actions which would be nice to have it always just a finger tip away, so I was wondering if we (the developers) are able to advance the Control

Is there programable access to the Control Strip of the macOS Touch Bar?

落花浮王杯 提交于 2019-11-30 12:00:21
The Control Strip is the static and global part of the macOS Touch Bar which is always visible in every context and app. While Apple provides full documentation about how to use the API to provide a contextual App Region in your macOS app, I couldn't find any notice about how to add stuff to the Control Strip . I could think of a lot of nice tools and actions which would be nice to have it always just a finger tip away, so I was wondering if we (the developers) are able to advance the Control Strip too? Is there any documentation or did anybody figure it out himself how to work wit Control

How get an item in control center of Touch Bar on the right?

时光毁灭记忆、已成空白 提交于 2019-11-28 18:51:01
The app TouchSwitcher add item beside lightscreen and volume items : https://hazeover.com/touchswitcher.html Is there a solution to display an item into the control strip on the right region of touch bar ? I can't find any help in official documentation about it... Please help me ! Here's what I use . Pass an NSView and an identifier of your choice to the controlStrippify() function. My attempts at doing the exact same thing using Swift have resulted in crashes, ports welcome :). Inspiration from https://github.com/a2/touch-baer . @import Cocoa; @import Foundation; // See: https://github.com

How get an item in control center of Touch Bar on the right?

雨燕双飞 提交于 2019-11-27 20:26:58
问题 The app TouchSwitcher add item beside lightscreen and volume items : https://hazeover.com/touchswitcher.html Is there a solution to display an item into the control strip on the right region of touch bar ? I can't find any help in official documentation about it... Please help me ! 回答1: Here's what I use. Pass an NSView and an identifier of your choice to the controlStrippify() function. My attempts at doing the exact same thing using Swift have resulted in crashes, ports welcome :).