Highly customizable Action Sheet Controller with Assets Preview written in Swift

Overview

PPAssetsActionController

CI Status codecov.io Version License Platform Swift Version Carthage compatible

Play with me ▢️ πŸ–

If you want to play with me, just tap here and enjoy! 🎩 πŸ•΄

Show me πŸŽͺ

show-me

Try me πŸ“²

The easiest way to try me (make sure you read Requirements section first):

pod try PPAssetsActionController

Requirements πŸ–₯

How to use me πŸ”©

It's super easy to start using PPAssetsActionController.

Make sure to checkout example project that features quite a few usecases

All you need to do is:

import PPAssetsActionController

func presentAssetsActionController() {
    let assetsPicker = PPAssetsActionController(with: [])
    present(assetsPicker, animated: true, completion: nil)
}

If you want to present couple of options, you do:

import PPAssetsActionController

func presentAssetsActionController() {
    let options = [
        PPOption(withTitle: option1String) { print("my option 1 callback") },
        PPOption(withTitle: option2String) { print("my option 2 callback") }
    ]
    let assetsPicker = PPAssetsActionController(with: options)
    present(assetsPicker, animated: true, completion: nil)
}

If you want to know what PPAssetsActionController has to say, become it's delegate:

import PPAssetsActionController

class CustomizationsViewController: UITableViewController {
    func presentAssetsActionController() {
        let options = [
            PPOption(withTitle: option1String) { print("my option 1 callback") },
            PPOption(withTitle: option2String) { print("my option 2 callback") }
        ]
        let assetsPicker = PPAssetsActionController(with: options)
        assetsPicker.delegate = self
        present(assetsPicker, animated: true, completion: nil)
    }
}

extension CustomizationsViewController: PPAssetsActionControllerDelegate {
    /**
    Callbacks implementations you're interested in.
    */
}

If you want to customize PPAssetsActionController's appearance or behavior check out PPAssetsActionConfig struct and use it like this:

import PPAssetsActionController

func presentAssetsActionController() {
    let options = [
        PPOption(withTitle: option1String) { print("my option 1 callback") },
        PPOption(withTitle: option2String) { print("my option 2 callback") }
    ]
    var config = PPAssetsActionConfig()
    config.tintColor = UIColor.magenta
    let assetsPicker = PPAssetsActionController(with: options, aConfig: config)
    present(assetsPicker, animated: true, completion: nil)
}

Localization πŸ’ͺ

Example project features complete localization to russian language including plurals.

If you want to check it out just run PPAssetsActionController_Example_Rus scheme.

For more info I suggest to check out this nice tutorial by Quentin Zervaas.

The article will put you up to speed with all intricacies of localization in no time.

Example πŸš€

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

Installation πŸ€–

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

pod 'PPAssetsActionController'

PPAssetsActionController is also available through Carthage. Add the following line to your Cartfile:

github "pantuspavel/PPAssetsActionController"

Developer Setup πŸ€“

To open the project:

git clone [email protected]:pantuspavel/PPAssetsActionController.git
cd PPAssetsActionController
bundle
cd Example
pod install
open PPAssetsActionController.xcworkspace

Tests πŸ›

To run automation tests you need to set up simulator and load assets first.

cd PPAssetsActionController
./.setup_sim.sh "name=iPad Air 2,OS=10.1" // See setup_sim.sh to discover all supported simulators.

When script finished go to Xcode and select just created simulator (assets-vs-ipad-ios10 for iPad version).

Press command+U, enjoy!

Required Info.plist keys πŸ”‘

If you're using PPAssetsActionController on iOS10 you need to declare NSPhotoLibraryUsageDescription, NSMicrophoneUsageDescription, NSCameraUsageDescription keys in your application's Info.plist or your app will crash on launch. For example refer to Example project's Info.plist. For more info read this article.

Feedback πŸ‘Œ

Feedback is very welcome. If you have an idea in mind don't hesitate to ping me on twitter @pantusp or here.

Contributions are very welcome and encouraged. If you have something to say file an issue or open a PR to start a conversation going.

Author πŸ‘‹

Pavel Pantus, @pantusp, [email protected]

License πŸ“–

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

Comments
  • Support (number of photos, customize buttons)

    Support (number of photos, customize buttons)

    I am using your library and it's very good, thanks for source code. I would like to request you to add things like

    1. Maximum number of photos or media that we can select
    2. Customize the default button i.e Snap Image or Video and send x items
    3. Update the documentation on how to call the delegate methods on the PPOption buttons let option = PPOption(withTitle: "Pick Image") { // I want to call assetsPicker(_ picker: PPAssetsActionController, didFinishPicking assets: [MediaProvider]) method on click of this button }

    This is what I found should be added.

    awaiting-input 
    opened by anirudhamahale 2
  • PPAssetManager: getImages: magic section: refactor array appending with appropriate array constructor

    PPAssetManager: getImages: magic section: refactor array appending with appropriate array constructor

    Replace

    let assets: [UIImage] = []
    for _ in 0..<result.count {
      let placeholderImage = UIImage(named: "checked", in: Bundle(for: PPAssetsActionController.classForCoder()), compatibleWith: nil)!
      assets.append(placeholderImage)
    }
    

    with

    let assets = Array(repeating: UIImage(...), result.count)
    
    enhancement help wanted 
    opened by pavelpantus 0
  • accessing photo gallery not working

    accessing photo gallery not working

    In the device (iPhone 7 – iOS 12.1.2) with permission granted for NSCameraUsageDescription, NSPhotoLibraryUsageDescription only the camera is showing, without any picture from the gallery.

    img_3323

    I'm using the basic example:

        let assetsPicker = PPAssetsActionController(with: [])
        assetsPicker.delegate = self
        present(assetsPicker, animated: true, completion: nil)
    

    this code works in simulator, showing pictures from photo gallery

    Looks like it's trying to load the pictures, but something is throwing the following errors:

    2019-01-17 13:56:27.934695-0300 Erudito[8228:2082240] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
    2019-01-17 13:56:27.937157-0300 Erudito[8228:2082240] [MC] Reading from public effective user settings.
    2019-01-17 13:56:28.185163-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b91df0> 38D71E9B-1676-4D4D-B7AA-E0AE0CDE1285/L0/001 mediaType=1/8, sourceType=1, (3024x4032), creationDate=2019-01-17 02:24:18 +0000, location=1, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.185984-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b91c40> 135E8504-2BC6-42BF-88E4-474826FD3413/L0/001 mediaType=1/8, sourceType=1, (3024x4032), creationDate=2019-01-17 02:24:15 +0000, location=1, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.186091-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b91a90> 9B8A0A33-A32B-4372-83DC-85AC3E7327A1/L0/001 mediaType=1/8, sourceType=1, (3024x4032), creationDate=2019-01-17 02:24:07 +0000, location=1, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.186148-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b918e0> 024C7CEF-E6B6-42A0-9049-79A22D188D13/L0/001 mediaType=1/8, sourceType=1, (3024x4032), creationDate=2019-01-17 00:32:58 +0000, location=1, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.186235-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b91730> 78978963-3449-4DD6-B149-2C6216133E5E/L0/001 mediaType=1/8, sourceType=1, (3024x4032), creationDate=2019-01-17 00:32:57 +0000, location=1, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.186322-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b91580> 6E9C82D4-EDE8-4A00-B134-1BB96FDAE5FA/L0/001 mediaType=1/8, sourceType=1, (3024x4032), creationDate=2019-01-17 00:32:54 +0000, location=1, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.186379-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b913d0> 697BBBEE-A1AF-454A-BBD6-8C22C5358E2A/L0/001 mediaType=1/8, sourceType=1, (3024x4032), creationDate=2019-01-17 00:32:50 +0000, location=1, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.186541-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b91220> E3340354-519A-4A33-B779-E2E0AD5B8F08/L0/001 mediaType=1/8, sourceType=1, (3024x4032), creationDate=2019-01-17 00:32:49 +0000, location=1, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.186955-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b91070> 98ACD6E7-C6F9-4E38-82C4-528D71570E7C/L0/001 mediaType=1/0, sourceType=1, (982x1280), creationDate=2019-01-16 22:33:16 +0000, location=0, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.187019-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b90ec0> CFC763C1-E9DF-49EB-B642-54AF524BDFF2/L0/001 mediaType=1/0, sourceType=1, (1269x1653), creationDate=2019-01-16 22:32:09 +0000, location=0, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.187103-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b90d10> 35FFC0FC-8C46-4CB8-A98D-5379EF94CED7/L0/001 mediaType=1/0, sourceType=1, (720x500), creationDate=2019-01-16 22:31:12 +0000, location=0, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.187159-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b90b60> 54C5EBB2-FD99-4E1F-B4A1-6E459AB93C7B/L0/001 mediaType=1/0, sourceType=1, (249x291), creationDate=2019-01-16 22:27:46 +0000, location=0, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.187287-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b8e130> B6D2E67F-7DDF-450D-B98A-B19919C642DC/L0/001 mediaType=1/0, sourceType=1, (920x920), creationDate=2019-01-16 22:24:39 +0000, location=0, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.187350-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b8df80> 628228FD-2E3D-48D2-A715-203843C57CC2/L0/001 mediaType=1/8, sourceType=1, (3024x4032), creationDate=2019-01-16 20:47:10 +0000, location=1, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.187473-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b8d5c0> 65D260DA-CC35-4C08-BF1F-E6ADA53A57BF/L0/001 mediaType=1/8, sourceType=1, (3024x4032), creationDate=2019-01-16 13:31:08 +0000, location=1, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.187599-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b8d410> 4658B3B1-A7C6-4B54-8B18-797B02475FFB/L0/001 mediaType=1/8, sourceType=1, (3024x4032), creationDate=2019-01-16 13:30:35 +0000, location=1, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.187654-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b8e8b0> 82374CEC-22EA-423F-BEDB-63DEADDDCE62/L0/001 mediaType=1/10, sourceType=1, (4032x3024), creationDate=2019-01-16 12:48:10 +0000, location=1, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.187728-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b8e500> 2861A3A3-F3EA-4E3C-81A9-6C946B2D8ABE/L0/001 mediaType=1/0, sourceType=1, (780x520), creationDate=2019-01-16 03:25:45 +0000, location=0, hidden=0, favorite=0  with format 9999
    2019-01-17 13:56:28.187786-0300 Erudito[8228:2082320] [Generic] Failed to load image data for asset <PHAsset: 0x106b8cc10> 45890583-5D68-455B-A6AF-9BE80F5232B7/L0/001 mediaType=1/0, sourceType=1, (719x1280), creationDate=2019-01-16 02:49:31 +0000, location=0, hidden=0, favorite=0  with format 9999
    
    opened by mromanuk 1
  • Swift 4.2 update?

    Swift 4.2 update?

    Hi, this is not really an issue, but more of a request. Are you planning on updating this to Swift 4.2 any time soon? Thanks for your work. This is a cool tool! :)

    opened by hermannkuschke 0
  • Add config field to limit amount of assets to be selected

    Add config field to limit amount of assets to be selected

    Let's introduce a new config field that would serve as a limit of selectable resources. If limit was reached, new cell can not be selected, unless previously selected cell was deselected.

    enhancement help wanted 
    opened by pavelpantus 0
  • Embed asset collection VC's view instead of collectionView

    Embed asset collection VC's view instead of collectionView

    Now Assets View Controller adds collection view of asset collection VC as a subview. View should be added instead. That prevents view controller appearance events to be called on assets collection vc. If you add view, collection view resize animation breaks.

    opened by pavelpantus 0
Releases(0.3.2)
Owner
Pavel Pantus
Pavel Pantus
A Shortcuts-like and highly customizable SFSymbol picker written in Swift.

SFTintedIconPicker SFTintedIconPicker is a Shortcuts-like and highly customizable SFSymbol picker written in Swift. Features Native Appearance Search

StephenFang 2 Aug 16, 2022
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

FlaneurApp 17 Feb 2, 2020
Read colors from Xcode assets file.

XcodePalette Read colors from Xcode assets file. How to Use Download the XcodePalette.Executable.zip of the latest release. Extract the XcodePalette U

iMoeNya 0 Nov 12, 2021
A UIActivityViewController to share images while displaying them as a nice preview.

PSActivityImageViewController Overview This view controller allows you to share an image the same way as a normal UIActivityViewController would, with

Peter Salz 11 Oct 19, 2022
iOS Framework that makes it easy to preview images on any UIImageView.

AZImagePreview iOS Framework that makes it easy to preview images on any UIImageView. Screenshots Installation: Cocoa Pods: pod 'AZImagePreview' Swift

Antonio Zaitoun 25 Dec 11, 2022
A library that makes defines your style sheet like a breeze.

Atelier A library that makes defines your style sheet like a breeze. Requirements iOS 13.0+ Xcode 12.0+ Swift 5.3+ Installation You can add Atelier to

Hsieh Min Che 1 Dec 29, 2022
πŸ“Έ iMessage-like, Image Picker Controller Provides custom features.

RAImagePicker Description RAImagePicker is a protocol-oriented framework that provides custom features from the built-in Image Picker Edit. Overview O

Rashed Al-Lahaseh 14 Aug 18, 2022
A view controller for iOS that allows users to crop portions of UIImage objects

TOCropViewController TOCropViewController is an open-source UIViewController subclass to crop out sections of UIImage objects, as well as perform basi

Tim Oliver 4.4k Jan 1, 2023
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
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

Cong Nguyen 648 Dec 27, 2022
Easy customizable avatar image asynchronously with progress bar animated

JDSwiftAvatarProgress ##Objective-C JDAvatarProgress is available in Objective-C also, JDAvatarProgress Usage To run the example project, clone the re

Jelly Development 86 May 16, 2022
A simple and customizable activity indicator.

ζ—₯本θͺž KRActivityIndicatorView KRActivityIndicatorView is a simple and customizable activity indicator written in Swift. You can add KRActivityIndicatorV

K.R.Impedance 47 Jul 11, 2022
PhotoEditor SDK: A fully customizable photo editor for your app.

About PhotoEditor SDK for iOS Our SDK provides tools for adding photo editing capabilities to your iOS application with a big variety of filters that

IMG.LY 116 Jan 1, 2023
Agrume - πŸ‹ An iOS image viewer written in Swift with support for multiple images.

Agrume An iOS image viewer written in Swift with support for multiple images. Requirements Swift 5.0 iOS 9.0+ Xcode 10.2+ Installation Use Swift Packa

Jan Gorman 601 Dec 26, 2022
FacebookImagePicker is Facebook album photo picker written in Swift.

Features β€’ Installation β€’ Usage β€’ Translation β€’ License GBHFacebookImagePicker is Facebook's album photo picker written in Swift, built to provide a s

Florian Gabach 231 Dec 17, 2022
A lightweight generic cache for iOS written in Swift with extra love for images.

Haneke is a lightweight generic cache for iOS and tvOS written in Swift 4. It's designed to be super-simple to use. Here's how you would initalize a J

Haneke 5.2k Dec 11, 2022
A lightweight and fast image loader for iOS written in Swift.

ImageLoader ImageLoader is an instrument for asynchronous image loading written in Swift. It is a lightweight and fast image loader for iOS. Features

Hirohisa Kawasaki 293 Nov 24, 2022
An image download extension of the image view written in Swift for iOS, tvOS and macOS.

Moa, an image downloader written in Swift for iOS, tvOS and macOS Moa is an image download library written in Swift. It allows to download and show an

Evgenii Neumerzhitckii 330 Sep 9, 2022
Fast and simple OCR library written in Swift

⛔️ This Project is deprecated and no longer gets maintained! Please use Apple's Vision framework instead of SwiftOCR. It is very fast, accurate and mu

Nicolas Camenisch 4.5k Dec 29, 2022