GithubHelp home page GithubHelp logo

haydenholligan / fdtake Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fulldecent/fdtake

0.0 2.0 0.0 433 KB

Easily take a photo or video or choose from library

License: MIT License

Swift 60.57% Ruby 0.88% Objective-C 32.63% Shell 5.92%

fdtake's Introduction

FDTake

[CI Status](https://travis-ci.org/William Entriken/FDTake) Version License Platform Readme Score

Usage

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

To use it in your project, add an FDTakeController to your view controller and implement:

fdTakeController.gotPhoto = {
    ...
}

then call:

fdTakeController.present()

The full API is:

/// Public initializer
public override init()

/// Convenience method for getting a photo
public class func getPhotoWithCallback(getPhotoWithCallback callback: (photo: UIImage, info: [NSObject : AnyObject]) -> Void)

/// Convenience method for getting a video
public class func getVideoWithCallback(getVideoWithCallback callback: (video: NSURL, info: [NSObject : AnyObject]) -> Void)

/// Whether to allow selecting a photo
public var allowsPhoto: Bool

/// Whether to allow selecting a video
public var allowsVideo: Bool

/// Whether to allow capturing a photo/video with the camera
public var allowsTake: Bool

/// Whether to allow selecting existing media
public var allowsSelectFromLibrary: Bool

/// Whether to allow editing the media after capturing/selection
public var allowsEditing: Bool

/// Whether to use full screen camera preview on the iPad
public var iPadUsesFullScreenCamera: Bool

/// Enable selfie mode by default
public var defaultsToFrontCamera: Bool

/// The UIBarButtonItem to present from (may be replaced by a overloaded methods)
public var presentingBarButtonItem: UIBarButtonItem?

/// The UIView to present from (may be replaced by a overloaded methods)
public var presentingView: UIView?

/// The UIRect to present from (may be replaced by a overloaded methods)
public var presentingRect: CGRect?

/// The UITabBar to present from (may be replaced by a overloaded methods)
public var presentingTabBar: UITabBar?

/// The UIViewController to present from (may be replaced by a overloaded methods)
public lazy var presentingViewController: UIViewController { get set }

/// A photo was selected
public var didGetPhoto: ((photo: UIImage, info: [NSObject : AnyObject]) -> Void)?

/// A video was selected
public var didGetVideo: ((video: NSURL, info: [NSObject : AnyObject]) -> Void)?

/// The user selected did not attempt to select a photo
public var didDeny: (() -> Void)?

/// The user started selecting a photo or took a photo and then hit cancel
public var didCancel: (() -> Void)?

/// A photo or video was selected but the ImagePicker had NIL for EditedImage and OriginalImage
public var didFail: (() -> Void)?

/// Custom UI text (skips localization)
public var takePhotoText: String?

/// Custom UI text (skips localization)
public var takeVideoText: String?

/// Custom UI text (skips localization)
public var chooseFromLibraryText: String?

/// Custom UI text (skips localization)
public var chooseFromPhotoRollText: String?

/// Custom UI text (skips localization)
public var cancelText: String?

/// Custom UI text (skips localization)
public var noSourcesText: String?

/// Presents the user with an option to take a photo or choose a photo from the library
public func present()

/// Dismisses the displayed view. Especially handy if the sheet is displayed while suspending the app,
public func dismiss()

Other available options are documented at CocoaDocs for FDTake.

How it works

  1. See if device has camera
  2. Create action sheet with appropriate options ("Take Photo" or "Choose from Library"), as available
  3. Localize "Take Photo" and "Choose from Library" into user's language
  4. Wait for response
  5. Bring up image picker with selected image picking method
  6. Default to selfie mode if so configured
  7. Get response, extract image from a dictionary
  8. Dismiss picker, send image to delegate

Support

  • Supports iPhones, iPods, iPads and tvOS (but not tested)
  • Supported languages:
    • English
    • Chinese Simplified
    • Turkish (thanks Suleyman Melikoglu)
    • French (thanks Guillaume Algis)
    • Dutch (thanks Mathijs Kadijk)
    • Chinese Traditional (thanks Qing Ao)
    • German (thanks Lars Häuser)
    • Russian (thanks Alexander Zubkov)
    • Norwegian (thanks Sindre Sorhus)
    • Arabic (thanks HadiIOS)
    • Polish (thanks Jacek Kwiecień)
    • Spanish (thanks David Jorge)
    • Hebrew (thanks Asaf Siman-Tov)
    • Danish (thanks kaspernissen)
    • Sweedish (thanks Paul Peelen)
    • Portugese (thanks Natan Rolnik)
    • Greek (thanks Konstantinos)
    • Italian (thanks Giuseppe Filograno)
    • Hungarian (thanks Andras Kadar)
    • Please help translate FDTake.strings to more languages
  • Pure Swift support and iOS 8+ required
  • Compile testing running on Travis CI
  • In progress: functional test cases (please help)
  • In progress: UI test cases (please help)
  • In progress: select last photo used (please help)

Installation

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

pod 'FDTake'

Author

William Entriken, [email protected]

License

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

fdtake's People

Contributors

andraskadar avatar dbachrach avatar filograno avatar fulldecent avatar guillaumealgis avatar hadycodes avatar igotit avatar jettf avatar kaspernissen avatar laplacesdemon avatar lauritzsh avatar lbanders avatar lh84 avatar mac-cain13 avatar mosamer avatar natanrolnik avatar nemoeslovo avatar pixelogik avatar ppeelen avatar sindresorhus avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.