I am relatively new to IOS App development and started learning it in Swift. Now I want to use the Adobe Creative SDK. Unfortunately all the sample codes are in C. So I would like to ask if somebody could shortly translate me the following basic example (given by AdobeCreativeSDK ImageEditor UI guide) into swift
- (void)displayEditorForImage:(UIImage *)imageToEdit
{
AdobeUXImageEditorViewController *editorController = [[AdobeUXImageEditorViewController alloc] initWithImage:imageToEdit];
[editorController setDelegate:self];
[self presentViewController:editorController animated:YES completion:nil];
}
I already tried an online converter (Swiftify), which created the following content:
func displayEditorForImage(imageToEdit: UIImage) {
var editorController: AdobeUXImageEditorViewController = AdobeUXImageEditorViewController(image: imageToEdit)
editorController.delegate = self
self.presentViewController(editorController, animated: true, completion: { _ in })
}
and XCode is telling me
Cannot assign value of type 'ViewController' to type 'AdobeUXImageEditorViewControllerDelegate?'
which I cannot interpret neither.
Ah already got it working... The Swift code is given by:
let editorController = AdobeUXImageEditorViewController(image: UIImage(data: data!)!)
self.presentViewController(editorController, animated: true, completion: { _ in })
,where I also deleted the Delegate.