Post

Replies

Boosts

Views

Activity

Double-tap Timeout Value?
How do I access the value in Settings → Accessibility → Double-tap Timeout? More details: I'm making a game with a SpriteView in SwiftUI that needs to react immediate to a touch while also detecting and responding to double, triple, and quadruple taps. To do this, I have the following: var touch: some Gesture {     var lastTouchTime = Date.now     var tapCounter = 1     return DragGesture(minimumDistance: 0, coordinateSpace: .local)         .onChanged() { touch in             // Respond immediately to touch.         }         .onEnded() { touch in             if lastTouchTime.timeIntervalSinceNow > -0.25 {                 tapCounter += 1             } else {                 tapCounter = 1             }             switch tapCounter {             case 1:                 break             case 2:                 // Respond to double-tap.             case 3:                 // Respond to triple-tap.             default:                 // Respond to quadruple tap.                 // Quintuple, sextuple, etc. taps also resolve here, which is fine.             }             lastTouchTime = Date.now         } } I would like to substitute 0.25 with the user's value in Accessibility settings, but I do not know how to access this value. The following does not work: .gesture(doubleTap) .gesture(singleTap) SwiftUI waits for the double-tap to fail before reacting to the single tap, which is not what I need, plus stacking triple and quadruple taps on top of this just fails.
2
0
1.5k
Jun ’22
Example of Gesture Protocol?
Apple’s developer documentation (https://developer.apple.com/documentation/swiftui/gesture) states that it is possible to “Create custom gestures by declaring types that conform to the Gesture protocol.” However, I cannot find an example of this anywhere on the internet. Does anyone have an example of a custom Gesture? Where would an app obtain touch data to begin with?
1
1
692
Jul ’22
"ignoring singular matrix" Console Message
I have a view where tapping text uses .scaleEffect to make the text disappear and reappear. An example follows: struct ContentView: View {     @State var textScaleFactor: CGFloat = 1.0     var body: some View {         Text("Hello, world!")             .font(.title)   // Makes text easier to tap.             .padding()             .scaleEffect(textScaleFactor)             .animation(.linear(duration: 0.25), value: textScaleFactor)             .onTapGesture {                 textScaleFactor = textScaleFactor == 1.0 ? CGFloat.zero : 1.0             }     } } Tapping the text to make it disappear causes the following message to appear in the console: ignoring singular matrix: ProjectionTransform(m11: 5e-324, m12: 0.0, m13: 0.0, m21: 0.0, m22: 5e-324, m23: 0.0, m31: 81.66666666666666, m32: 31.0, m33: 1.0) ignoring singular matrix: ProjectionTransform(m11: 5e-324, m12: 0.0, m13: 0.0, m21: 0.0, m22: 5e-324, m23: 0.0, m31: 81.66666666666666, m32: 31.0, m33: 1.0) Does anybody know what this means? One website says that the message is "a warning", but a warning of what?
2
1
2.4k
Sep ’22
Suppress CoreGraphics or Image I/O Console Messages
I'm using CoreGraphics and Image I/O in a MacOS command-line tool. My program works fine, but after the first drawing to a bitmap context there are messages output to the console like the following: 2022-12-20 16:33:47.824937-0500 RandomImageGenerator[4436:90170] Metal API Validation Enabled AVEBridge Info: AVEEncoder_CreateInstance: Received CreateInstance (from VT) AVEBridge Info: connectHandler: Device connected (0x000000010030b520)Assert - (remoteService != NULL) - f: /AppleInternal/Library/BuildRoots/43362d89-619c-11ed-a949-7ef33c48bc85/Library/Caches/com.apple.xbs/Sources/AppleAVEBridge/AppleAVEEncoder/AppleAVEEncoder.c l: 291 AVE XPC Error: could not find remote service Assert - (err == noErr) - f: /AppleInternal/Library/BuildRoots/43362d89-619c-11ed-a949-7ef33c48bc85/Library/Caches/com.apple.xbs/Sources/AppleAVEBridge/AppleAVEEncoder/AppleAVEEncoder.c l: 1961 AVE ERROR: XPC failed AVEBridge Info: stopUserClient: IOServiceClose was successful. AVEBridge Error: AVEEncoder_CreateInstance: returning err = -12908 These messages get in the way of my own console output. How do I stop these messages from being displayed? This post on StackOverflow (https://stackoverflow.com/questions/37800790/hide-strange-unwanted-xcode-logs) does not appear to be relevant to this issue.
1
1
1.4k
Dec ’22