I know that I can double-click an IKImageView and bring up the edit panel. And in Objective C I can do this
- (IBAction)editPanel:(id)sender {
IKImageEditPanel *editor = [IKImageEditPanel sharedImageEditPanel];
[editor setFrameOrigin:NSMakePoint(400,200)];
[editor setDataSource:imageView]; // Here imageView is your IKImageView.
[editor makeKeyAndOrderFront:nil];
}
But, when I try to set the data source in swift, I get an error saying I can't assign this type of IKImageView! to a value of type IKImageEditPanelDataSource!
Here is my code:
@IBAction func adjustments(sender: NSToolbarItem) {
let editor = IKImageEditPanel.sharedImageEditPanel()
editor.setFrameOrigin(NSPoint(x: 400, y: 200))
editor.dataSource = imageView //Error on this line
editor.makeKeyAndOrderFront(nil)
}
From the apple forums....
I needed to tell the IKImageView that it should conform to the IKImageEditPanelDataSource. (It does this already, but I had to explicitly say so to the quiet the compiler).
Outside of any class ...
extension IKImageView: IKImageEditPanelDataSource {
}