Latest 0.1.5
Homepage https://github.com/byvapps/ByvImagePicker
License MIT
Platforms ios 9.0
Dependencies ByvUtils, TOCropViewController
Authors

CI Status
Version
License
Platform

ByvImagePicker is a NSObject class that can present an action sheet to select the UIImagePickerController source type and let edit image with TOCropViewController in 3 different ways.

Usage

To only display picker:

@IBAction func pickImage(_ sender: UIButton) {
    if picker == nil {
        picker = ByvImagePicker()
    }
    let from = ByvFrom(controller: self, from:sender.frame, inView:self.view, arrowDirections:.any)
    picker!.getImage(from: from, completion: { image in
        self.imageView.image = image
    })
}

To pick editable image:

@IBAction func pickAndEdit(_ sender: UIButton) {
    if picker == nil {
        picker = ByvImagePicker()
    }
    let from = ByvFrom(controller: self, from:sender.frame, inView:self.view, arrowDirections:.any)
    picker!.getImage(from: from, editable:true, completion: { image in
        self.imageView.image = image
    })
}

To pick an Image with forced aspect ratio:

@IBAction func pickAndCrop(_ sender: UIButton) {
    if picker == nil {
        picker = ByvImagePicker()
    }
    let from = ByvFrom(controller: self, from:sender.frame, inView:self.view, arrowDirections:.any)
    picker!.getFixedImage(from: from, customAspectRatio: imageView.bounds.size, completion: { image in
        self.imageView.image = image
    })
}

To pick a circular image:

@IBAction func pickProfile(_ sender: UIButton) {
    if picker == nil {
        picker = ByvImagePicker()
    }
    let from = ByvFrom(controller: self, from:sender.frame, inView:self.view, arrowDirections:.any)
    picker!.getCircularImage(from: from, completion: { image in
        self.profileImage.image = image
    })
}

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

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

pod "ByvImagePicker"

Author

Adrian Apodaca, [email protected]

License

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

Latest podspec

{
    "name": "ByvImagePicker",
    "version": "0.1.5",
    "summary": "Library to pick image from camera or library and edit or crop image",
    "description": "With ByvImagePicker you can in one method display an action sheet to choose camera or photoLibrary, and then edit image with TOCropViewController",
    "homepage": "https://github.com/byvapps/ByvImagePicker",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Adrian Apodaca": "[email protected]"
    },
    "source": {
        "git": "https://github.com/byvapps/ByvImagePicker.git",
        "tag": "0.1.5"
    },
    "platforms": {
        "ios": "9.0"
    },
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "4.0"
    },
    "source_files": "ByvImagePicker/Classes/**/*",
    "dependencies": {
        "ByvUtils": [
            "~> 1.1"
        ],
        "TOCropViewController": [
            "2.3.4"
        ]
    },
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This