Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lufzi/ubud
🏞 Carousel photo browser library for iOS.
https://github.com/lufzi/ubud
carousel ios photobrowser swift
Last synced: 21 days ago
JSON representation
🏞 Carousel photo browser library for iOS.
- Host: GitHub
- URL: https://github.com/lufzi/ubud
- Owner: lufzi
- License: mit
- Created: 2017-11-01T01:44:37.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-02T03:36:21.000Z (almost 7 years ago)
- Last Synced: 2024-10-31T15:47:18.445Z (2 months ago)
- Topics: carousel, ios, photobrowser, swift
- Language: Swift
- Homepage:
- Size: 4.31 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Ubud
[![BuddyBuild](https://dashboard.buddybuild.com/api/statusImage?appID=5a240e4e7463140001ebe6ea&branch=master&build=latest)](https://dashboard.buddybuild.com/apps/5a240e4e7463140001ebe6ea/build/latest?branch=master)
[![Build Status](https://travis-ci.org/lkmfz/Ubud.svg?branch=master)](https://travis-ci.org/lkmfz/Ubud)
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Ubud.svg)](https://cocoapods.org/pods/Ubud)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
## Requirements
**iOS 9** or later## Installation
### [CocoaPods](https://cocoapods.org/)
To integrate Ubud using CocoaPods, add the following to your Podfile:
````ruby
pod 'Ubud'
````
### [Carthage](https://cocoapods.org/)
To integrate Ubud using Carthage, add the following to your Cartfile:
````ruby
github 'lkmfz/Ubud'
````
Run `carthage update` to build the framework and drag the built `Ubud.framework` into your Xcode project.## Usage
To present the `UbudController` view, just put this one line code.
```swift
UbudController.show(presentedBy: self, dataSource: self, paginationDelegate: self, atIndex: indexPath.item)
```### UbudControllerDataSource
```swift
enum PhotoDataSource {
case image(UIImage)
case url(String)
}
```To display images from list of URL`String`
```swift
// MARK: - UbudControllerDataSourcefunc numberOfOPhotos(in controller: UbudController) -> Int {
return urls.count
}func imageSourceForItem(in controller: UbudController, atIndex index: Int) -> PhotoDataSource {
let imageURL = urls[index].url.absoluteString
return .url(imageURL)
}
```To display images from list of `UIImage`
```swift
// MARK: - UbudControllerDataSourcefunc numberOfOPhotos(in controller: UbudController) -> Int {
return images.count
}func imageSourceForItem(in controller: UbudController, atIndex index: Int) -> PhotoDataSource {
let image = images[index]
return .image(image)
}
```### UbudControllerDelegate
Customize the `UbudController` style
```swift
// MARK: - UbudControllerDelegatefunc statusBarHidden(in controller: UbudController) -> Bool {
return false
}func statusBarStyle(in controller: UbudController) -> UIStatusBarStyle {
return .lightContent
}func dismissButtonContent(in controller: UbudController) -> DismissButtonContent {
return .text("Dismiss")
}
```### UbudControllerPaginationDelegate
```swift
enum ImagesPaginationStyle {
case textIndicator
case dotIndicator
}
```Customize the pagination indicator style
```swift
// MARK: - UbudControllerPaginationDelegatefunc imagesPaginationStyle(in controller: UbudController) -> ImagesPaginationStyle? {
return .dotIndicator
}func imagesPaginationDidChange(in controller: UbudController, atIndex index: Int) {
/// Do anything on tapped image page content
}
```## License
Ubud is released under the [MIT License](https://github.com/lkmfz/Ubud/blob/master/LICENSE.md).