Latest 0.1.4
Homepage https://github.com/swiftcafex/GracefulImagePicker
License MIT
Platforms ios 8.0
Dependencies CircleProgressBar
Authors

CI Status
Version
License
Platform

Example

GracefulImagePicker is a designed and simple UI component for pick image from system album. Like the image show above, it provide a better user experience than the default native component.

这篇文档的简体中文版本

Requirements

  • Swift 4.0
  • CocoaPods

Installation

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

pod 'GracefulImagePicker'

Usage

First import the GracefulImagePicker framework:

import GracefulImagePicker

Then:

let pickerController = GracefulImagePickerViewController()
pickerController.imageSelected = { image, asset in

    // handle image picked

}
self.navigationController?.pushViewController(pickerController, animated: true)

Create a GracefulImagePickerViewController, and set imageSelected callback, which provide the selected image and asset.

Use Config

You can also config the GracefulImagePickerViewController:

let config = ImagePickerConfiguration()
config.style = .Black
config.reverseImageList = true

let pickerController = GracefulImagePickerViewController(config: config)
pickerController.imageSelected = { image, asset in

    // handle image picked.

}
self.navigationController?.pushViewController(pickerController, animated: true)

Currently, the ImagePickerConfiguration class support two config, style and reverseImageList.

  • Style: .White or .Black indicate the color theme of the image picker.
  • reverseImageList: Default to false. if set to true, the image will be display in reverse order in the album.

Use View Directly

If you do not like ues the ViewController, you can also use GracefulImagePickerView, that a UIView subclass, can be directly added to view hierarchy:

var pickerView = GracefulImagePickerView(frame: CGRect.zero)
pickerView?.backClicked = {

self.dismiss(animated: true, completion: nil)

    // handle back button clicked.

}

pickerView?.imageSelected = { image, asset in

    // handle image picked

}
self.view.addSubview(pickerView)

GracefulImagePickerView has similar callback of GracefulImagePickerViewController, except , it has an additional backClicked callback, which handle the back button clicked of image picker.

Last , The ImagePickerConfiguration class, also applied to GracefulImagePickerView :

let config = ImagePickerConfiguration()
config.style = .Black
config.reverseImageList = true

pickerView = GracefulImagePickerView(frame: CGRect.zero, config: config)

Author

My email: [email protected]
You can also follow me on wechat:

License

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

Latest podspec

{
    "name": "GracefulImagePicker",
    "version": "0.1.4",
    "summary": "A functional UI component for pick image on iOS.",
    "description": "A functional UI component for pick image on iOS. .",
    "homepage": "https://github.com/swiftcafex/GracefulImagePicker",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "SwiftCafe": "[email protected]"
    },
    "source": {
        "git": "https://github.com/swiftcafex/GracefulImagePicker.git",
        "tag": "0.1.4"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "GracefulImagePicker/Classes/**/*",
    "resources": "GracefulImagePicker/Assets/*.png",
    "resource_bundles": {
        "GracefulImagePicker": [
            "GracefulImagePicker/Assets/*.png"
        ]
    },
    "dependencies": {
        "CircleProgressBar": []
    },
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This