Reputation: 29
I have this snippet of code
var dataFormat: AudioStreamBasicDescription?
var propSize: UInt32 = UInt32(MemoryLayout<AudioStreamBasicDescription>.size)
try SCoreAudioError.check(status: AudioFileGetProperty(audioFileID!, kAudioFilePropertyDataFormat, &propSize, &dataFormat), "Couldn't get file's data format")
The variable is somekind being filled, but the llbd debugger shows my variable dataFormat
value as nil
(by printing it with po dataFormat
), while the Variable inspector says that such variable is not nil
(it is equal to some
with a content)
Upvotes: 0
Views: 70
Reputation: 29
I found a solution
I had to initialize the AudioStreamBasicDescription
, before passing it as a reference
var dataFormat = AudioStreamBasicDescription.init()
I had gotten confused because it looks like the pattern of passing an empty optional by reference to then be filled is common with opaque
types (I think)..
Upvotes: 1