SwiftUI Metal View - MTKView - UIDE1E9J4F390216T

Опубликовано: 23 Май 2026
на канале: Lawrence Tsang
609
4

CC0 images from Pixabay and Pexels
For Testing and Educational Purposes
UIDE1E9J4F390216T
No source code will be posted.
(Quick and dirty patches from
My own project and others)
Because,
Copyrighted material may be included.

Tested floating point rating representation
With stars and gradient.
See
Paul Hudson's Star

https://www.hackingwithswift.com/quic...

Thanks to "SwiftUIExtensions"
Github MIT Project for the Slider.

https://github.com/SwiftUIExtensions/...



MyMetalViewController, may be downloaded
From my previously uploaded video and link.
(Not sure about YT, 
Flickr link should be valid)
===============================================

Appear GC works, no leaks
performance is better




Most examples for Representable,
Use iOS ImagePicker and Delegate to
Get the image.




This test is on the reverse direction.
Load an Image from SwiftUI, instruct 
The representable to draw it.




There are no Delegate protocol,
Just an external method in
MyMetalViewController.




That method will be called 
Indirectly, by
SwiftUI's Representable's 
"updateNSViewController"




The update will be triggered by
The change of any @State Var.




For testing only,
I passed,
URL, fragment-shader-mode-no,
Value1.




For the actual test,
A lot more parameters will be required.
(An object that contains the parameters,
Will be used as a parameter.)




Also, try to use the same layout as
PanoCropViewer.
RHS panel is of Fixed Width and
Contains Rows of sliders and Buttons.
LHS image box, problem with initial
Resize, but after manual resize window,
Subsequent images will fit, ok.




=======================
Image Resources:
CC0 Images from Pixabay and Pexels