3 ms·
As of Swift 1.something, C structs get imported with an empty initializer that sets everything to zero. So that pattern can be written in Swift as: var bar
by mikeash 11y ago
As of Swift 1.something, C structs get imported with an empty initializer that sets everything to zero. So that pattern can be written in Swift as:
var bar = foo()
foo_init(&bar)
No worse than the C version, as long as the unnecessary initialization is not a performance problem (which it usually isn't).