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 simple, highly informative page view controller

TL;DR UIPageViewController done properly. ⭐️ Features Simplified data source management & enhanced delegation. Dynamically insert & remove pages. Infi

UI At Six 1.8k Dec 24, 2022
Simple and highly customizable iOS tag list view, in Swift.

TagListView Simple and highly customizable iOS tag list view, in Swift. Supports Storyboard, Auto Layout, and @IBDesignable. Usage The most convenient

Ela Workshop 2.5k Jan 5, 2023
Easy to use, highly customizable gauge view

GDGauge - Customizable Gauge View Requirements Xcode 11+ Swift 5 iOS 9+ Installation Swift Package Manager .package(url: "https://github.com/saeid/GDG

Saeid 74 Dec 5, 2022
A controller that uses a UIStackView and view controller composition to display content in a list

StackViewController Overview StackViewController is a Swift framework that simplifies the process of building forms and other static content using UIS

Seed 867 Dec 27, 2022
Zeplin component preview for your SwiftUI views

A Zeplin component preview for your SwiftUI views. You can use Zeplin components instead of real views within your app until you implement them.

Danis Tazetdinov 4 Sep 1, 2022
A spotlight-inspired quick action bar for macOS.

DSFQuickActionBar A spotlight-inspired quick action bar for macOS. Why? I've seen this in other mac applications (particularly spotlight) and it's ver

Darren Ford 31 Dec 14, 2022
MZFormSheetPresentationController provides an alternative to the native iOS UIModalPresentationFormSheet, adding support for iPhone and additional opportunities to setup UIPresentationController size and feel form sheet.

MZFormSheetPresentationController MZFormSheetPresentationController provides an alternative to the native iOS UIModalPresentationFormSheet, adding sup

MichaΕ‚ Zaborowski 979 Nov 17, 2022
Declarative, configurable & highly reusable UI development as making Lego bricks.

LeeGo is a lightweight Swift framework that helps you decouple & modularise your UI component into small pieces of LEGO style's bricks, to make UI dev

WANG Shengjia 969 Dec 29, 2022
UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

Mohsan Khan 29 Sep 9, 2022
A highly configurable and out-of-the-box-pretty UI library

We absolutely love beautiful interfaces! As an organization named Unicorn, we are obligated to be unique and majestic.

Clayton (McIlrath) Unicorn 225 Feb 11, 2022
SwiftUI components and extensions that seem to be highly reusable

SwiftUI components and extensions that seem to be highly reusable

Yusuke Hosonuma 56 Dec 15, 2022
Reel Search is a Swift UI controller that allows you to choose options from a list

REEL SEARCH Reel Search is a Swift UI controller that allows you to choose options from a list We specialize in the designing and coding of custom UI

Ramotion 2.5k Dec 21, 2022
AGCircularPicker is helpful component for creating a controller aimed to manage any calculated parameter

We are pleased to offer you our new free lightweight plugin named AGCircularPicker. AGCircularPicker is helpful for creating a controller aimed to man

Agilie Team 617 Dec 19, 2022
A child view controller framework that makes setting up your parent controllers as easy as pie.

Description Family is a child view controller framework that makes setting up your parent controllers as easy as pie. With a simple yet powerful publi

Christoffer Winterkvist 246 Dec 28, 2022
A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed flag

HidesNavigationBarWhenPushed A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed

Danil Gontovnik 55 Oct 19, 2022
A set of UIKit helpers that simplify the usage of UIKit view's and controller's in SwiftUI.

A set of UIKit helpers that simplify the usage of UIKit view's and controller's in SwiftUI. Many of these helpers are useful even in a pure UIKit project.

SwiftUI+ 6 Oct 28, 2022
A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.

SwiftUI Drawer A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize. Contents Add the Package Basic Usage Examples Credits

Michael Verges 695 Jan 3, 2023
Infinite paging controller, scrolling through contents and title bar scrolls with a delay

PageController PageController is infinite paging controller, scrolling through contents and title bar scrolls with a delay. Then it provide user inter

Hirohisa Kawasaki 408 Nov 28, 2022