I am new to Swift and I would like to save the image data after the user has selected their photos from their photo library. I am using DKImagePickerController (https://github.com/zhangao0086/DKImagePickerController) to select the image assets.
/**
* An `DKAsset` object represents a photo or a video managed by the `DKImagePickerController`.
*/
public class DKAsset: NSObject {
/// Returns a UIImage that is appropriate for displaying full screen.
private var fullScreenImage: (image: UIImage?, info: [NSObject : AnyObject]?)?
/// Returns the original image.
private var originalImage: (image: UIImage?, info: [NSObject : AnyObject]?)?
...
Above is a short snapshot of the DKAsset class. Below is what is did to make the class conform to NSCoding.
required convenience init?(coder decoder: NSCoder) {
let fullScreenImage = decoder.decodeObjectForKey("fullScreenImage") as! UIImage
}
func encodeWithCoder(aCoder: NSCoder) {
aCoder.encodeObject(fullScreenImage, forKey: "fullScreenImage")
}
But I get this error message "Cannot convert value of type '(image: UIImage?, info:[NSObject: AnyObject]?)?' to expected argument type 'AnyObject'".
How should I go about encoding that variable?