ios - How do I use CFArrayRef in Swift? -
I am using Objective-class in my Swift Project through a bridging header. The method signature looks like this:
- Some cement (some type) some parameters;
I started by getting an example of class, calling method, and storing the value:
var myInstance = MyClassWithThatMethod (); Var cfArr = myInstance.someMethod (some value);
Then try to get the value in the array:
var valueInArrayThatIWant = CFArrayGetValueAtIndex (cfArr, 0);
However, I get the error unmanaged & lt; Cfarray & gt; Not like 'CFArray'
. Unmanaged & lt; Cfarray & gt;
also means?
I looked, but I do not need to change the array in a fast array (though it would be good). I need to be able to get value from the array.
I also tried CFArray
method to pass in a function:
func doSomeStuffOnArray (myArray: NSArray) {} < / Code>
Although I get the same error when using:
doSomeStuffOnArray (cfArr); // unmanaged & lt; CFArray & gt; I am using CFArray
because I want to store an array of CGPathRef
Required, which can not be stored in NSArray
. So how do I use the CFArray
Swift?
comment with
- as you have said, "
Festivals> CF_RETURNS_RETAINED
orCF_RETURNS_NOT_REETAINED
. In your case:- (CFRRERFF) Some methods: (some type) some parameters CF_RETURNS_NOT_RETAINED; Memory managed object with
-
or
lake-lined value ()
orle-rented value ()
convert unmanaged objects in your case Swift:var cfArr = myInstance.someMethod (someValue) Ktakanukrmanit value ()
Comments
Post a Comment