Latest 1.0.0
Homepage https://github.com/LorTos/LTImagePicker
License MIT
Platforms ios 11.0
Frameworks UIKit, AVFoundation, CoreImage
Authors





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.

Latest podspec

{
    "name": "LTImagePicker",
    "version": "1.0.0",
    "summary": "Custom ImagePicker and camera with crop features.",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/LorTos/LTImagePicker",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "LorTos": "[email protected]"
    },
    "source": {
        "git": "https://github.com/LorTos/LTImagePicker.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "11.0"
    },
    "swift_version": "4.2",
    "source_files": "LTImagePicker/Classes/**/*",
    "resource_bundles": {
        "LTImagePicker": [
            "LTImagePicker/Assets/*"
        ]
    },
    "frameworks": [
        "UIKit",
        "AVFoundation",
        "CoreImage"
    ]
}

Pin It on Pinterest

Share This