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.

Overview

AvatarImagePicker & AuthSettings

&

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"

Swift Package Manager

.package(url: "https://github.com/janlionly/AvatarImagePicker.git", .upToNextMajor(from: "1.3.0")),

Usage

AvatarImagePicker is presented with an actionsheet for camera and photo library, and then presented an ImagePickerController, optional some properties supports to customize, like sourceTypes, presentStyle and dismissAnimated.

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

Swift

let picker = AvatarImagePicker.instance

// optional: custom properties
picker.dismissAnimated = false // default is true
picker.sourceTypes = [.camera] // default is [.camera, .photoLibrary]
picker.presentStyle = .overFullScreen // default is .fullScreen

// this method includes authorizing for photolibrary and camera.
picker.present(allowsEditing: true, selected: { (image) in
	// selected image
}) {
	// tapped cancel
   } 


// v1.3.2 updated: support to customize actions for sheet
picker.sourceTypes = [.camera, .customAction]
weak var weakSelf = self
picker.customActions = ["Delete": { weakSelf?.imageView.image = nil }]


// or you can call only auth photolibrary and camera, it will alert the user to go to settings if the photolibrary or camera was denied.
let isAuthSuccess = AuthSettings.authPhotoLibrary(message: "auth photolibrary to get your avatar") {
  print("auth success")
  // go to present image picker controller(photo library), customize your operation here.
}
_ = AuthSettings.authCamera(message: "auth camera to get your avatar") {
  print("auth success")
  // go to present image picker controller(camera), customize your operation here.
}

Objective-C

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

Requirements

  • iOS 9.0+
  • Swift 4.2 to 5.2

Author

Visit my github: janlionly
Contact with me by email: [email protected]

Contribute

I would love you to contribute to AvatarImagePicker

License

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

You might also like...
A photo gallery for iOS with a modern feature set. Similar features as the Facebook photo browser.
A photo gallery for iOS with a modern feature set. Similar features as the Facebook photo browser.

EBPhotoPages ”A photo gallery can become a pretty complex component of an app very quickly. The EBPhotoPages project demonstrates how a developer coul

DGCropImage - A photo cropping tool which mimics Photo.app written by Swift
DGCropImage - A photo cropping tool which mimics Photo.app written by Swift

DGCropImage A photo cropping tool which mimics Photo.app written by Swift. This

Photo-Sharing-App - Photo Sharing App With Swift
Photo-Sharing-App - Photo Sharing App With Swift

Photo Sharing App You can register and log in to this application and share your

The camera shoot a photo when animals apear in the frame
The camera shoot a photo when animals apear in the frame

AutoCatDogCam The camera shoot a photo when animals apear in the frame. How to u

Get  a photo which has effects like the system camera’s Portrait mode (on compatible devices).
Get a photo which has effects like the system camera’s Portrait mode (on compatible devices).

Blurring background like Portrait mode in the iPhone camera If we want to have the blurring effect like the Portrait mode in the iOS Camera app. What

FMPhotoPicker is a modern, simple and zero-dependency photo picker with an elegant and customizable image editor
FMPhotoPicker is a modern, simple and zero-dependency photo picker with an elegant and customizable image editor

FMPhotoPicker is a modern, simple and zero-dependency photo picker with an elegant and customizable image editor Quick demo Batch select/deselect Smoo

Photo Browser / Viewer inspired by Facebook's and Tweetbot's with ARC support, swipe-to-dismiss, image progress and more
Photo Browser / Viewer inspired by Facebook's and Tweetbot's with ARC support, swipe-to-dismiss, image progress and more

IDMPhotoBrowser IDMPhotoBrowser is a new implementation based on MWPhotoBrowser. We've added both user experience and technical features inspired by F

FlaneurImagePicker is an iOS image picker that allows users to pick images from different sources (ex: user's library, user's camera, Instagram...).                            It's highly customizable.
FlaneurImagePicker is an iOS image picker that allows users to pick images from different sources (ex: user's library, user's camera, Instagram...). It's highly customizable.

FlaneurImagePicker is a highly customizable iOS image picker that allows users to pick images from different sources (ex: device's library, device's c

AYImageKit is a Swift Library for Async Image Downloading, Show Name's Initials and Can View image in Separate Screen.
AYImageKit is a Swift Library for Async Image Downloading, Show Name's Initials and Can View image in Separate Screen.

AYImageKit AYImageKit is a Swift Library for Async Image Downloading. Features Async Image Downloading. Can Show Text Initials. Can have Custom Styles

Comments
  • Crash in iPad

    Crash in iPad

    This was crashed in iPad. Because the following code doesn't work on iPad. var sheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) So I fixed this like following var sheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) if (UIDevice.current.userInterfaceIdiom == .pad) { sheet = UIAlertController(title: nil, message: nil, preferredStyle: .alert) }

    opened by seniorlancer 1
DTPhotoViewerController - A fully customizable photo viewer ViewController to display single photo or collection of photos, inspired by Facebook photo viewer.

DTPhotoViewerController Example Demo video: https://youtu.be/aTLx4M4zsKk DTPhotoViewerController is very simple to use, if you want to display only on

Tung Vo 277 Dec 17, 2022
Custom iOS camera and photo picker with editing capabilities

Overview Paparazzo is a component for picking and editing photos. Key Features ?? Taking photos using camera ?? Picking photos from user's photo libra

avito.tech 757 Jan 4, 2023
PixPic, a Photo Editing App

PixPic PixPic, a Photo Editing App Built by Our iOS Interns What's the best way to teach interns how to write an iOS app? Just let them do it! This ap

Yalantis 1.3k Dec 24, 2022
Gallery has a clearer flow based on albums and focuses on the use case of selecting video

Description We all love image pickers, don't we? You may already know of ImagePicker, the all in one solution for capturing pictures and selecting ima

null 1 Sep 14, 2022
An iOS app that helps you check, edit and delete metadata of photos, including but not limited to EXIF, TIFF...

MetaX A simple iOS app that helps you check, edit and delete metadata of photos, including but not limited to EXIF, TIFF... Feature List main metadata

Yuhan Chen 189 Dec 29, 2022
Vision Camera 📸 The Camera library that sees the vision.

Vision Camera ?? The Camera library that sees the vision. npm i react-native-vision-camera npx pod-install Documentation Guides API Ex

Marc Rousavy 3.5k Jan 5, 2023
React-native-photo-editor - Photo editor using native modules for iOS and Android

?? Image editor using native modules for iOS and Android. Inherit from 2 available libraries, ZLImageEditor (iOS) and PhotoEditor (Android)

Baron Ha. 244 Jan 5, 2023
Slide image viewer library similar to Twitter and LINE.

Overview You can use it simply by passing the necessary information! Serrata is a UI library that allows you to intuitively view images. Features King

Takuma Horiuchi 324 Dec 9, 2022
A free, multiplatform SDK for real-time facial motion capture using blendshapes, and rigid head pose in 3D space from any RGB camera, photo, or video.

mocap4face by Facemoji mocap4face by Facemoji is a free, multiplatform SDK for real-time facial motion capture based on Facial Action Coding System or

Facemoji 592 Jan 1, 2023
CameraButton - A simple camera button that can be used for photo and video capturing

CameraButton A simple camera button that can be used for photo and video capturi

Erik Drobne 9 Dec 22, 2022