CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

LTImagePicker 1.0.0

LTImagePicker 1.0.0

Maintained by Lorenzo Toscani De Col.



  • By
  • LorTos

LTImagePicker

Example

The example project contains a sample usage of this pod. Feel free to play around with it. To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

  • Creating coordinator

Create a LTImagePickerCoordinator in the ViewController where you want the flow to start, passing a LTPickerConfig to customise appearance. Add a Notification to receive the image when you made the final choice.

var coordinator: LTImagePickerCoordinator?

override func viewDidLoad() {
    super.viewDidLoad()
    NotificationCenter.default.addObserver(self, selector: #selector(selectedImage(_:)), name: .didFinishPickingImage, object: nil)

    let config = LTPickerConfig(navBackgroundColor: UIColor.black,
                                navTintColor: UIColor.white,
                                accentColor: UIColor(red: 249/255, green: 215/255, blue: 68/255, alpha: 1),
                                shouldShowTextInput: false)
    coordinator = LTImagePickerCoordinator(configuration: config)
}
  • Start flow

Then simply call:

coordinator?.startCameraFlow(from: self)

to start the flow with the Camera. Otherwise call:

coordinator?.startLibraryPickerFlow(from: self)

to start the flow with the photo library.

  • Get image and message

Call the function that you passed as the selector in the Notification to receive the available data.

@objc private func selectedImage(_ sender: Notification) {
    // Image always exists
    if let image = sender.userInfo?["image"] as? UIImage {

    }

    // Message is available only if you decided to show the textInput
    // in the LTPickerConfig and you write something
    if let message = sender.userInfo?["message"] as? String, !message.isEmpty {

    }
}

Installation

LTImagePicker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'LTImagePicker'

and run pod install

Author

LorTos, [email protected]

License

LTImagePicker is available under the MIT license. See the LICENSE file for more info.