https://github.com/opensooq/abra
Your next favorite image and video picker from Gallery for Swift
https://github.com/opensooq/abra
gallery image-picker swift video-picker
Last synced: about 1 year ago
JSON representation
Your next favorite image and video picker from Gallery for Swift
- Host: GitHub
- URL: https://github.com/opensooq/abra
- Owner: OpenSooq
- License: other
- Created: 2017-11-30T13:41:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-04T13:59:58.000Z (over 8 years ago)
- Last Synced: 2024-03-14T16:43:38.989Z (over 2 years ago)
- Topics: gallery, image-picker, swift, video-picker
- Language: Swift
- Size: 8.54 MB
- Stars: 19
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README

`AbraGallery` is a small library for images & videos picking. It provides video recording too.
### Usage
`GalleryController` is the main entry point, just instantiate and set the delegate:
```swift
let gallery = GalleryController()
gallery.delegate2 = self
present(gallery, animated: true, completion: nil)
```
### Delegate
The `GalleryControllerDelegate2` requires you to implement some delegate methods in order to interact with the `GalleryController`
```swift
public protocol GalleryControllerDelegate2: class {
func galleryController(_ controller: GalleryController, requestLightbox images: [UIImage])
func galleryControllerDidCancel(_ controller: GalleryController)
func galleryController(_ controller: GalleryController, didSelectAssets assets: [PHAsset])
}
```
### Permission
`Gallery` handles permissions for you. It checks and askes for photo and camera usage permissions at first launch. As of iOS 10, we need to explicitly declare usage descriptions in plist files
```xml
NSCameraUsageDescription
This app requires access to camera
NSPhotoLibraryUsageDescription
This app requires access to photo library
```
You may disable permissions flow by the config `Gallery.Config.Permission.shouldCheckPermission = false`
### Configuration
There are lots of customization points in `Config` structs. For example
```swift
Config.Permission.image = UIImage(named: ImageList.Gallery.cameraIcon)
Config.Font.Text.bold = UIFont(name: FontList.OpenSans.bold, size: 14)!
Config.Camera.recordLocation = true
Config.Camera.recordMode = .video // to enable video recording.
Config.VideoRecording.maxBytesCount = 1024 // to set the maximum size of video.
Config.VideoRecording.maxLengthInSeconds = .video // to set the max length of video.
Config.Selection.mode = [.photo, .camera, .video] // to enable/disable Photo, Camera and Video tabs.
Config.SessionPreset.quality = AVCaptureSessionPresetHigh // to define the quality of recorded video.
... and many many more at Config file.
```
## Installation
**AbraGallery** is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:
```ruby
pod 'AbraGallery'
```
**AbraGallery** can also be installed manually. Just download and drop `Sources` folders in your project.
## Author & Contact
OpenSooq, ramzi.q@opensooq.com, damian.k@opensooq.com
Abra Gallery is build at the top of [Gallery](https://github.com/blueimp/Gallery) project.
## Contributing
We would love you to contribute to **AbraGallery**, check the [CONTRIBUTING](https://github.com/hyperoslo/Gallery/blob/master/CONTRIBUTING.md) file for more info.
## License
**AbraGallery** is available under the MIT license. See the [LICENSE](https://github.com/hyperoslo/Gallery/blob/master/LICENSE.md) file for more info.