LittleOwl
要求
- Swift 3.2 或更高版本
- iOS 8.0 或更高版本
Carthage
- 将
github "DarkySwift/LittleOwl" ~> 1.0
添加到 Cartfile。 - 运行
carthage update
。 - 在
Carthage/Build
中将应用链接到LittleOwl
。
CocoaPods
- 将
pod 'LittleOwl', '~> 1.0'
添加到 Podfile。 - 运行
pod install
。
准备工作
从 iOS 10 开始,Apple 要求在您应用的信息束(info.plist)中添加 NSCameraUsageDescription
和 NSMicrophoneUsageDescription
字符串。例如:
<key>NSCameraUsageDescription</key>
<string>To Take Photos and Video</string>
<key>NSMicrophoneUsageDescription</key>
<string>To Record Audio With Video</string>
入门
如果你从 Cocoapods 安装 SwiftyCam,请确保将模块导入到你的视图控制器中
import LittleOwl
LittleOwl 是一个方便的便利框架。要创建一个 Camera 实例,只需添加以下内容
let cameraController = CameraViewController(type: .video(10))
cameraController.didSelectVideo = { url in
cameraController.dismiss(animated: true, completion: nil)
}
或者
let cameraController = CameraViewController(type: .photo)
cameraController.didSelectPhoto = { image in
cameraController.dismiss(animated: true, completion: nil)
}
That is all that is required to setup the AVSession for photo and video capture. LittleOwl will prompt the user for permission to use the camera/microphone, and configure both the device inputs and outputs.
## Author
Carlos Duclós
## License
LittleOwl is available under the MIT license. See the LICENSE file for more info.