Post

Replies

Boosts

Views

Activity

SwiftUI ColorPicker "opened" and "closed" events?
I need to be able to undo / redo the colors that are picked with the new SwiftUI ColorPicker ( on the iPad : it's presented as a floating window ) The thing that makes my job very difficult is that there is apparently no way to know that *the user has indeed chosen a color ( and therefore closed the panel )* Instead, the behavior of ColorPicker is that it will keep updating the binded color as the user is manipulating the color controls. This is very helpful to show a live preview, but you don't want to register all these color variations for undo / redo purposes : you only want the color that was finally picked. Therefore there is no logical distinction between the colors that the user *tried*, and the one that was *selected* And I looked everywhere : there aren't any modifiers or notifications related to that. I know SwiftUI hasn't been there for long, but this seems like a crucial functionality that's missing! Has anyone found a workaround?
0
2
705
Mar ’21
Metal Shader : Pointer vs Local Copy Performance
I have a metal kernel function that has a huge array of data for input, stored in device memory, and I'm basically using one element per thread for further processing.device Element *elements [[ buffer(0) ]],I'm wondering what's better in terms of performance? :Make a copy of the array element into local thread memory :Element element = elements[thread_id];Or, use a pointer to that element :device Element *element = &particles[thread_id];
1
0
1.1k
Apr ’20