ios - Swift: CGPathRelease and ARC -
just updated xcode beta 4, , noticed following compiler error code below:
var path = cgpathcreatemutable() ... cgpathrelease(path)
'cgpathrelease' unavailable: core foundation objects automatically memory managed
so remove release calls , should fine? or there more i'm missing? , there special cases should aware of arc?
the working cocoa data types section of using swift cocoa , objective-c says (emphasis mine):
core foundation objects returned annotated apis automatically memory managed in swift—you not need invoke
cfretain
,cfrelease
, orcfautorelease
functions yourself. if return core foundation objects own c functions , objective-c methods, annotate them eithercf_returns_retained
orcf_returns_not_retained
.…
when swift imports apis have not been annotated, compiler cannot automatically memory manage returned core foundation objects. swift wraps these returned core foundation objects in
unmanaged<t>
structure.
so yes, unless have unmanaged
struct, correct , don't have worry manually releasing object.
Comments
Post a Comment