Today, I found something strange :
I wanted to write this code in swift :
NSData *data = [myImage representationUsingType: NSPNGFileType properties: nil];
In swift it's look like this:
var data: NSData = imageToSave?.representationUsingType( NSPNGFileType ,
properties: nil)
The problem is that the compiler say : " Use of unresolved identifier 'NSPNGFileType'". Does anyone have any idea why ?
Thanks, and sorry for my english !
You probably have to use .NSPNGFileType
, or more explicitly NSBitmapImageFileType.NSPNGFileType
In Swift 3 this has changed to simply .PNG
or as the full version NSBitmapImageFileType.PNG
(docs).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With