Skip to content

A single line of code for selecting the optional editing image from Camera or Photo Library, including handling the authorizations of Photo library and Camera.

License

Notifications You must be signed in to change notification settings

janlionly/AvatarImagePicker

Repository files navigation

Version Carthage Compatible License Platform Swift

Description

AvatarImagePicker is a photo library and camera Image Picker for iOS
written in Swift, it's just a single line of code, support for selecting user's avatar by Camera or Photo Library, editing the selected image. Also, it supports auth verification, if camera or photo library was denied, it will alert the user to the settings for opening it. it means to replace for UIImagePickerController. Compatible with both Swift and Objective-C.

Installation

CocoaPods

pod 'AvatarImagePicker'

Carthage

github "janlionly/AvatarImagePicker"

Usage

AvatarImagePicker is presented with an actionsheet for camera and photo library, and then presented an ImagePickerController.

Remember to add NSCameraUsageDescription and NSPhotoLibraryUsageDescription's keys for descriptions to your Info.plist

Swift

AvatarImagePicker.instance.present(allowsEditing: true, selected: { (image) in
	// selected image
}) {
	// tapped cancel
   }

Objective-C

[[AvatarImagePicker avatarImagePicker] presentWithAllowsEditing:YES selected:^(UIImage * _Nonnull image) {
        // selected image
    } cancel:^{
        // tapped cancel
    }];

Requirements

  • iOS 9.0+
  • Swift 4.2 to 5.0

Author

Visit my github: janlionly
Contact with me by email: janlionly@gmail.com

Contribute

I would love you to contribute to AvatarImagePicker

License

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

About

A single line of code for selecting the optional editing image from Camera or Photo Library, including handling the authorizations of Photo library and Camera.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published