
DS Photo Editor SDK
A Photo Editor Built for Developers
Getting started with DS Photo Editor SDK for iOS (Objective-C)
This guide will show you how to integrate DS Photo Editor SDK into your iOS apps, within just minutes!
Prerequisites
1. Download iOS SDK:
2. The following software is required:
-
Xcode 10 or higher
-
iOS 9 or higher
3. Since all the image tools in the SDK are GPU-accelerated and run close to real-time, you will need a real device to see the performance of the SDK. Simulators will NOT work properly and are NOT able to indicate SDK performance.
Adding the SDK to an iOS Project
1. Switch to "General" tab in your target.
Click "+" button under "Embedded Binaries".
Click "Add Other" and then add the "DSPhotoEditorSDK.framework" you downloaded.
You should see something similar to the screenshot below. You can also check the "Framework Search Paths" under "Build Settings" to make sure that the framework path is successfully added.
Note: If you are using XCode 12 and above, you may need to go to "Build Settings" -> "Validate Workspace" and update the flag to be "Yes".

2. Run "strip-frameworks.sh" script.
Switch to "Build Phases" tab, and then add a "Run Script" if it is not present. Then add the line below to the bash script.
bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/DSPhotoEditorSDK.framework/strip-frameworks.sh"
You should see something similar to the screenshot below.

3. In the header file of your view controller, import the DSPhotoEditorSDK.h and then conform to the DSPhotoEditorViewControllerDelegate protocol as below:
......
#import <DSPhotoEditorSDK/DSPhotoEditorSDK.h>
@interface ViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate, DSPhotoEditorViewControllerDelegate>
4. In the implementation file of your view controller, launch the DS Photo Editor using the code below.
If you don't want some tools to show up, simply pass in an NSArray with TOOL_*** to hide them, otherwise pass in nil for toolsToHide to display all the tools in the SDK.
- (void) launchDSPhotoEditorSDK: (UIImage *) original {
/**
Optional: You can pass in an NSArray to hide the tools you don't want as below:
NSArray *toolsToHide = @[@(TOOL_ORIENTATION), @(TOOL_PIXELATE)];
**/
DSPhotoEditorViewController *dsPhotoEditorController = [[DSPhotoEditorViewController alloc] initWithImage:original toolsToHide:nil];
dsPhotoEditorController.delegate = self;
dsPhotoEditorController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:dsPhotoEditorController animated:YES completion:nil];
}
Implement the following methods to receive cancel and complete events from the editor:
- (void)dsPhotoEditor:(DSPhotoEditorViewController *)editor finishedWithImage:(UIImage *)image {
[self dismissViewControllerAnimated:YES completion:nil];
// handle the result image here
}
- (void)dsPhotoEditorCanceled:(DSPhotoEditorViewController *)editor {
[self dismissViewControllerAnimated:YES completion:nil];
}
Important Notes:
1. DS Photo Editor SDK has some tools with transparency processing, such as round corner and circle crop image. Therefore, you need to save png image to see these effects. You can use the code below to save the result image as PNG file:
NSData* pngData = UIImagePNGRepresentation (image);
UIImage* pngImage = [UIImage imageWithData:pngData];
UIImageWriteToSavedPhotosAlbum(pngImage, nil, nil, nil);
2. You may need to update your info.plist file to include "Privacy - Photo Library Usage Description" and "Privacy - Photo Library Additions Usage Description" entries, so that you can load and save photos on devices.