Context
While extending the Array type to conform to VectorArithmetic (for core animation experiment):
extension Array: VectorArithmetic where Element: VectorArithmetic & AdditiveArithmetic { ... }
I get the following error:
Referencing operator function '*' on '_VectorMath' requires that 'Element' conform to '_VectorMath'
and when calling the scale(by:) method:
Referencing instance method 'scale(by:)' on 'Array' requires that 'Double' conform to '_VectorMath'
Workaround
Making type Element and Double conform to _VectorMath fixed the issue:
extension Array: VectorArithmetic where Element: _VectorMath & VectorArithmetic & AdditiveArithmetic { ... }
extension Double: _VectorMath { }
Questions
I tried looking for information on _VectorMath (note the underscore prefix) but I could not find anything in the official docs and not much on the internet.
What is _VectorMath protocol?
Where is it defined?
Is it ok to use it like this?
Or should I use a different approach?
Post
Replies
Boosts
Views
Activity
How can one set MKMapView scale unit to use the metric system (meter, kilometer) or the imperial system (foot, mile) in an app, in code?
I looked in the SwiftUI documentation, I could not find any mention of this in the MKMapView doc.
My phone is set to use metric system (metres) and Apple Maps does show the scale meters; but not my app.
Thanks
I am trying to update XCode to 13.2 on Monterey.
It's stuck at "Installing 7.49GB of 7.49GB" (been for a while...).
I tried rebooting the mac and and the install is still stuck.
Reported issue on Feedback assistant (number FB9808696).
What can I do?
Previous version of XCode still runs ok.
In a Document-based app, in SwiftUI (iOS 17), how to bring to front the window that shows an already open document, when trying to open the same document from the file browser, instead of opening a new window?
This is to prevent opening the document twice and being able to edit it in 2 different editors.
The official demo [1] does not handle this case.
[1] https://developer.apple.com/documentation/swiftui/building_a_document-based_app_with_swiftui
Hi,
I am using HealthKit for the first time.
I am using HKStatisticsCollectionQuery.
I am running my code iOS 17 on a physical iPhone.
It takes several seconds to query data, for example 1 day worth of heart rate at 1 minute resolution. I changed the resolution to 1 hour, expecting it to be faster, but it's pretty much the same…
I have been following the official documentation and sample code.
I also compiled in Release, but that didn't really help for HKStatisticsCollectionQuery.
I quickly looked with Instruments, the app is spending a lot of time in decoding data with NSXPCDecoder.
Is there a way to speed data retrieval? Or this is "expected" latency?