AutoreleasingUnsafeMutablePointer for an NSString

Viewed 1782

I have an AVDepthDataObject and I am trying to call the dictionaryRepresentation() function. The function takes an AutoreleasingUnsafeMutablePointer<NSString?> as an argument, and I'm running into problems.

I've tried:

//Make a string and a pointer
let depthString: NSString = NSString()
let depthStringPointer = AutoreleasingUnsafeMutablePointer<NSString?>.init(&depthString)

//Dump the depth data into the str
depthData.dictionaryRepresentation(forAuxiliaryDataType: depthStringPointer)

But I get an error on the depthStringPointer initialization saying:

'&' used with non-inout argument of type 'RawPointer'

I'm not sure how to properly initialize the AutoreleasingUnsafeMutablePointer for a NSString type.

I tried:

depthData.dictionaryRepresentation(forAuxiliaryDataType: &depthString)

per this question, but I get an error saying

Cannot pass immutable value of type 'NSString?' as inout argument

0 Answers
Related