dimanche 12 novembre 2017

.self after struct type in Swift

I am confused by a line of code found in the metal example where the memory pointer is bound to a type.

uniforms = UnsafeMutableRawPointer(uniformBuffer.contents()).bindMemory(to: Uniforms.self, capacity: 1)

My confusion is the .self after the Uniforms type. Uniforms is a struct defined in an Objective-C file and the code wont run without .self being in the call. Why is that necessary?





Aucun commentaire:

Enregistrer un commentaire