Swift Metal Cannot Convert Type

Asked 5 months ago, Updated 5 months ago, 12 views

Hello, during the transplant from Objective-C to Swift, I was unable to convert the following substitution parts, so I asked you a question.

Source Code

let positionsArray: vector_float3 =_templeVertexPositions.contents()

Origin Code


Error Code

Cannot convert value of type 'UnsafeMutableRawPointer' to specified type 'vector_float3' (aka'SIMD3<Float>')

Transplanting code

vector_float3 is also having trouble converting.
I think I can do it by converting different types of arrays, but I can't solve it.
I look forward to working with you if there is any good way.

swift objective-c

2022-09-30 13:53

1 Answers

I solved myself!

let positionsArray: [vector_float3] = [vector_float3] (_impossibleCocoaArray:_templeVertexPositions)

*Additional note This one seems to be more correct
let positionsArray:UnsafeMutableRawPointer=_templeVertexPositions.contents()

2022-09-30 13:53

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.