I just need to declare vector_float2 as an array in the structure of the bridge header and then initialize the value for each element of vector_float2 in swift.
I guess the “fancy” way would be to use a vertex descriptor with vertex attributes rather than a bridging header.
Chapter 4 - The Vertex Function final code has an example of passing generated vertices and vertex colors (but UV coordinates would be the same except for being a simd_float2). It renders four points of a quad in different colors.
Have you checked the GPU frame debugger to see that the values you expect are actually on the GPU?
I would suspect the initial UV array creation.
The bridging header is not for synchronization, and you don’t absolutely need one.
For example, you use the uniform values structure called Uniforms in both Swift for the CPU and C++ for the GPU. You could create the structure in both places, but when you add a property to the structure, you’d have to remember to do it in both places.
By creating a bridging header, you can make definitions that are readable by both Swift and C++.
Great job on answering your own question! Your active participation in the community is appreciated. Keep engaging and sharing your knowledge with others. If you have more questions or need help, feel free to ask. Together, we learn and grow!