Home > Enterprise >  Creating a Photo Editor with Brightroom | Swift
Creating a Photo Editor with Brightroom | Swift

Time:02-03

The code I was shown for creating a Brightroom photo editor, that offers all of the different Brightroom features, was:

@IBAction func editImage(_ sender: Any) {
        guard let image = image else { return }
        let editor = Brightroom.Editor(image: image)
        present(editor.controller, animated: true, completion: nil)
    }

This code is now out-of-date and inaccurate. Additionally, the GitHub documentation is not very thorough. Would someone please show me how I could create the editor shown in the GitHub visual examples (image editor, photo cropping, masking)?

Brightroom Library

CodePudding user response:

If you want to create a Photo Editor (or, add that functionality to your app), your best bet is to go through that Brightroom code and learn how to do it.

However, if you want a quick example of presenting its built-in editor:

@IBAction func editImage(_ sender: Any) {

    guard let image = UIImage(named: "samplePic")
    else {
        print("Could not load image named \"samplePic\"!")
        return
    }
        
    let imageProvider: ImageProvider = ImageProvider(image: image)
    
    let editingStack = EditingStack(imageProvider: imageProvider)
    
    let controller = ClassicImageEditViewController(editingStack: editingStack)
    
    present(controller, animated: true, completion: nil)

}
  • Related