• Stars
    star
    1,450
  • Rank 31,223 (Top 0.7 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ImagePickerSheetController replicates the custom photo action sheet in iMessage.

ImagePickerSheetController

Twitter: @lbrndnr License Carthage compatible

About

ImagePickerSheetController is a component that replicates the custom photo action sheet in iMessage. It's very similar to UIAlertController which makes its usage simple and concise. โš ๏ธYou can also find an iOS 10 version of this library hereโš ๏ธ

Screenshot

Usage

ImagePickerSheetController is similar to UIAlertController in its usage.

Example

let controller = ImagePickerSheetController(mediaType: .ImageAndVideo)
controller.addAction(ImagePickerAction(title: NSLocalizedString("Take Photo Or Video", comment: "Action Title"), secondaryTitle: NSLocalizedString("Add comment", comment: "Action Title"), handler: { _ in
	presentImagePickerController(.Camera)
}, secondaryHandler: { _, numberOfPhotos in
	println("Comment \(numberOfPhotos) photos")
}))
controller.addAction(ImagePickerAction(title: NSLocalizedString("Photo Library", comment: "Action Title"), secondaryTitle: { NSString.localizedStringWithFormat(NSLocalizedString("ImagePickerSheet.button1.Send %lu Photo", comment: "Action Title"), $0) as String}, handler: { _ in
	presentImagePickerController(.PhotoLibrary)
}, secondaryHandler: { _, numberOfPhotos in
	println("Send \(controller.selectedImageAssets)")
}))
controller.addAction(ImagePickerAction(title: NSLocalizedString("Cancel", comment: "Action Title"), style: .Cancel, handler: { _ in
	println("Cancelled")
}))
            
presentViewController(controller, animated: true, completion: nil)

It's recommended to use stringsdict to easily translate plural forms in any language.

Installation

CocoaPods

pod "ImagePickerSheetController", "~> 0.9.1"

###Carthage

github "lbrndnr/ImagePickerSheetController" ~> 0.9.1

You should also add two new values to your app's Info.plist to tell the user why you need to access the Camera and Photo Library.

<key>NSCameraUsageDescription</key>
<string>Camera usage description</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo Library usage description</string>

Requirements

ImagePickerSheetController is written in Swift and links against Photos.framework. It therefore requires iOS 9.0 or later.

Author

I'm Laurin Brandner, I'm on Twitter.

License

ImagePickerSheetController is licensed under the MIT License.

More Repositories

1

LBYouTubeView

A MPMoviePlayerViewController subclass that can display YouTube videos.
Objective-C
527
star
2

nuage-macos

A native SoundCloud app for macOS, written in SwiftUI
Swift
298
star
3

LBGIFImage

This is a small category that creates an animated UIImage out of a gif image.
Objective-C
174
star
4

StackNavigationView

A SwiftUI component for macOS that makes complex view hierarchies possible
Swift
106
star
5

LBProgressBar

This is a custom subclass of NSProgressIndicator designed by Orman Clark (http://www.premiumpixels.com/)
Objective-C
87
star
6

LBGradient

NSGradient for iOS
Objective-C
68
star
7

ImagePickerTrayController

The iOS 10 version of ImagePickerSheetController
Swift
68
star
8

LBActionSheet

A very customizable drop-in replacement for UIActionSheet
Objective-C
47
star
9

LBAudioDetective

An audio fingerprinting library to compare audio signals
Objective-C
40
star
10

LBSegmentedButton

This is a twitter-like button.
Objective-C
29
star
11

SoundCloud

The private SoundCloud API v2 in Swift
Swift
25
star
12

MuseumGuide

A small framework that makes UIImage accessible
Swift
22
star
13

Sweets

A framework that extends UIKit so that it's somewhat convenient to use with Swift
Swift
16
star
14

ethz-summaries-b15

Cheat Sheets und Zusammenfassungen Basisjahr D-INFK 2015/16 ETHZ
TeX
12
star
15

spotit

Python
8
star
16

SearchField

A GitHub-like search field for SwiftUI.
Swift
8
star
17

alexandria-extension

A browser extension for academic papers
TypeScript
8
star
18

swift-stm

An optimistic STM written in Swift
Swift
6
star
19

Scholarship

iPad app that I use as a resume to apply for scholarships.
Swift
5
star
20

wink

A little script that takes a picture when you wink
Python
4
star
21

RetainCarousel

This is a small category that helps you finding retain cycles.
Objective-C
4
star
22

Blog

Source code for my blog posts
Objective-C
3
star
23

HackZurich

Objective-C
2
star
24

Spectral

A ยตframework that adds hex support to UIColor/NSColor
Swift
2
star
25

AtomicLinkedList

A lazy, lock-free linked list
Swift
2
star
26

nutshell-macos

An AI-powered note-taking app for your meetings. Built for macOS using SwiftUI.
Swift
1
star
27

poly

๐ŸŒˆ poly - a crowd-sourced and AI-assisted localization tool
Rust
1
star
28

hotkeyd

Simple and hackable global keyboard shortcuts for macOS.
Rust
1
star