FDTake 3.0.0

FDTake 3.0.0

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布最新版本2019年4月
SPM支持SPM

William Entriken维护。




FDTake 3.0.0

FDTake

CI Status Version License Platform Readme Score

轻松拍照或录像或从库中选择

🍺作者的小费罐:https://amazon.com/hz/wishlist/ls/EE78A23EEGQB

用法

要运行示例项目,克隆仓库,并首先从示例目录运行 pod install

要在您的项目中使用它,请向视图控制器添加一个 FDTakeController 并实现

fdTakeController.didGetPhoto = {
    (_ photo: UIImage, _ info: [AnyHashable : Any]) in
}

然后调用

fdTakeController.present()

完整的API如

/// Public initializer
public override init()

/// Convenience method for getting a photo
open class func getPhotoWithCallback(getPhotoWithCallback callback: @escaping (_ photo: UIImage, _ info: [AnyHashable : Any]) -> Void) -> <<error type>>

/// Convenience method for getting a video
open class func getVideoWithCallback(getVideoWithCallback callback: @escaping (_ video: URL, _ info: [AnyHashable : Any]) -> Void)

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

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

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

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

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

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

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

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

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

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

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

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

/// A photo was selected
open var didGetPhoto: ((_ photo: UIImage, _ info: [AnyHashable : Any]) -> Void)?

/// A video was selected
open var didGetVideo: ((_ video: URL, _ info: [AnyHashable : Any]) -> Void)?

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

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

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

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

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

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

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

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

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

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

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

其他可用选项在 CocoaDocs for FDTake 中有文档说明。

工作原理

  1. 检查设备是否有摄像头
  2. 使用合适的选项(“拍照”或“从库中选择”)创建操作表,如果有的话
  3. 将“拍照”和“从库中选择”本地化为用户的语言
  4. 等待响应
  5. 弹出图像选择器并选择选定图像方法
  6. 默认为自拍模式(如果已配置)
  7. 获取响应,从字典中提取图像
  8. 关闭选择器,将图像发送到代理

支持

  • 支持iPhone、iPod、iPad和tvOS(未经测试)
  • 支持的语言
    • 英语
    • 简体中文
    • 土耳其语(感谢Suleyman Melikoglu)
    • 法语(感谢Guillaume Algis)
    • 荷兰语(感谢Mathijs Kadijk)
    • 繁体中文(感谢Qing Ao)
    • 德语(感谢Lars Häuser)
    • 俄语(感谢Alexander Zubkov)
    • 挪威语(感谢Sindre Sorhus)
    • 阿拉伯语(感谢HadiIOS)
    • 波兰语(感谢Jacek Kwiecień)
    • 西班牙语(感谢David Jorge)
    • 希伯来语(感谢Asaf Siman-Tov)
    • 丹麦语(感谢kaspernissen)
    • 瑞典语(感谢Paul Peelen)
    • 葡萄牙语(感谢Natan Rolnik)
    • 希腊语(感谢Konstantinos)
    • 意大利语(感谢Giuseppe Filograno)
    • 匈牙利语(感谢Andras Kadar)
    • 请帮助翻译FDTake.strings到更多语言
  • 纯Swift支持,iOS 8+需求
  • 在Travis CI上编译测试运行
  • 进行中:功能测试案例(请帮助
  • 进行中:UI测试案例(请帮助
  • 进行中:选择最后使用的照片(请帮助

安装

FDTake可通过CocoaPods获得。要安装它,只需将以下行添加到您的Podfile中

pod 'FDTake'

作者

William Entriken,[email protected]

项目范围

这是一个成熟的项目,除非在其它应用程序中已经出现什么最新的技术,我们不会添加新功能。请在提出功能请求之前准备好引用其他应用程序的屏幕截图。

我们支持最新发布的 Xcode、Carthage、CocoaPods 和 Swift Package Manager 的版本。如果有不兼容的情况,例如 CocoaPods 不支持最新版本的 Xcode,我们将仅支持受到支持的最新发布的版本/组合。如果您想支持这些软件包的预发布版本,请提交一个 pull request,而不是 issue。

授权

FDTake 在 MIT 授权下可用。更多信息请参阅 LICENSE 文件。

贡献

此项目的布局基于 https://github.com/fulldecent/swift4-module-template。如果您想更改布局,请首先更改该项目。另外,您可能会欣赏那个项目有“recipes”——您不仅需要更改代码,还需要解释您为何要这么做。作为维护者,这使得我的工作更加简单。类似地,如果您在进行非次要更改时,如果您能引用其他项目(如 AlamoFire)来讨论您遇到的设计挑战的类型,这将非常有帮助。再次感谢,我们真的非常感激您的贡献。