I've created a context using CGBitmapContextCreate. Do I need to release it using CGContextRelease? I know the answer is yes in Objective-C, but how about in Swift?
Thanks!
I've created a context using CGBitmapContextCreate. Do I need to release it using CGContextRelease? I know the answer is yes in Objective-C, but how about in Swift?
Thanks!
CFTypes are automatically managed unless explicitly specified as Unmanaged.
According to the documentation. https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/WorkingWithCocoaDataTypes.html
Unmanaged types will have the type signature
CGBitmapContextCreate
has the type signatureHence its managed automatically by swift.
No, you don't need to call
CGContextRelease
. In fact, trying to gives you this error:CGContext
instances are automatically memory managed in Swift. You can tell from the function signature:A return value you would need to release yourself would look like: