There is a write function documented in the CoreImage Metal shader reference here: https://developer.apple.com/metal/MetalCIKLReference6.pdf
But I'm not sure how to use it. I assumed one would be able to use it on the destination parameter i.e. dest.write(...) but I get the error, "no member named 'write' in 'coreimage::destination'"
How do I use this function?
Post not yet marked as solved
I've created a custom BoxBlur kernel that produces identical results to Apple's built-in box blur (CIBoxBlur) kernel but my custom kernel is orders of magnitude slower. So naturally I am wondering what I'm doing wrong to get such poor performance. Below is my custom kernel in the Metal shading language. Can you spot why it's so slow? The built-in filter performs well so I can only assume it's something I'm doing wrong.
#include <CoreImage/CoreImage.h>
#import <simd/simd.h>
extern "C" {
namespace coreimage {
float4 customBoxBlurFilterKernel(sampler src) {
float2 crd = src.coord();
int edge = 100;
int minx = crd.x - edge;
int maxx = crd.x + edge;
int miny = crd.y - edge;
int maxy = crd.y + edge;
float4 sums = float4(0,0,0,0);
float cnt = 0;
// compute average of surrounding rgb values
for(int row=miny; row < maxy; row++) {
for(int col=minx; col < maxx; col++) {
float4 samp = src.sample(float2(col, row));
sums[0] += samp[0];
sums[1] += samp[1];
sums[2] += samp[2];
cnt += 1.;
}
}
return float4(sums[0]/cnt, sums[1]/cnt, sums[2]/cnt, 1);
}
}
}
I have been working with several SwiftUI apps using Catalyst for Mac support. There seems to be a major issue where the entire app or portions of the app become unresponsive to clicks or other events seemingly because a loss of focus. Sometimes it is recoverable by clicking around random parts of the window, but sometimes it is just stuck. Does anyone know how to get this under control, or perhaps start controlling which parts of the app get focus?
Also, when returning from modal states, focus seems to land on a random ui element. I would like to know how to control this.
Post not yet marked as solved
Hello. I've figured out how to make the new SF Symbols (V3) Beta crash consistently. This crash makes the custom symbols functionality of the app inaccessible. All you need to do is drop a certain custom SF Symbol template into the app and it will start crashing. I've filed a feedback with the file attached and instructions to reproduce (FB9217085).
I'm posting here to hopefully increase the odds of this being addressed in a timely fashion as I'm trying to add support for V3 SF Symbols to my app.
Post not yet marked as solved
When you adjust the pitch to something greater than the default, the voice pitch becomes gradually more distorted. The only way to fix it is by creating a new instance of AVSpeechSynthesizer which ultimately leads to a crash due to a leak in system code.
Post not yet marked as solved
A Custom SF symbol template doesn't render properly when using a SwiftUI Image. For example: Image(uiImage:UIImage(named:"my_custom_symbol")!)
The resulting image is stretched to fit the space defined by the left and right margins of the custom symbol.
It works fine in a UIKit view.
Post not yet marked as solved
There’s no way to know when a DragGesture() has been canceled. Perhaps this was left out of SwiftUI on purpose because the onEnded event should suffice?
Well I think that's wrong because when there’s a DragGesture on a view inside a ScrollView, the DragGesture’s onChanged event get’s triggered when you start scrolling the content inside the ScrollView however the DragGesture’s onEnded event is never fired apparently because it was CANCELED by the act of scrolling the ScrollView.
BUT there’s no way for me to know that it was cancelled because there's no canceled event handler like we had for such things in UIKit. So my code is left in an incorrect state where it thinks it’s in the middle of a DragGesture. But it isn't.
Post not yet marked as solved
Starting with iOS 14.2, AVSpeechSynthesizer will crash when it has a delegate assigned which implements the method, speechSynthesizer(_:willSpeakRangeOfSpeechString:utterance:).
The mere presence of the above method in the delegate will cause a crash BUT ONLY WITH CERTAIN VOICES. For example the default voice crashes while the enhanced voice, Alex does not.
I've created a simple project (which I've submitted through Feedback Assistant) with two buttons which demonstrates how one voice will cause a crash while another will not.
This breaks critical functionality of my app and my customers are not happy.
Any help with this would be much appreciated!
Post not yet marked as solved
Hello. I've used SwiftUI to create some custom UI, some of which is not resizable so I wanted to use showsLargeContentViewer=true as you can with any UIKit view.
Is there a way to do this with SwiftUI views? If there is I haven't found it. Thanks