iOS 9 or later
To integrate Ubud using CocoaPods, add the following to your Podfile:
pod 'Ubud'
To integrate Ubud using Carthage, add the following to your Cartfile:
github 'lkmfz/Ubud'
Run carthage update
to build the framework and drag the built Ubud.framework
into your Xcode project.
To present the UbudController
view, just put this one line code.
UbudController.show(presentedBy: self, dataSource: self, paginationDelegate: self, atIndex: indexPath.item)
enum PhotoDataSource {
case image(UIImage)
case url(String)
}
To display images from list of URLString
// MARK: - UbudControllerDataSource
func 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
// MARK: - UbudControllerDataSource
func numberOfOPhotos(in controller: UbudController) -> Int {
return images.count
}
func imageSourceForItem(in controller: UbudController, atIndex index: Int) -> PhotoDataSource {
let image = images[index]
return .image(image)
}
Customize the UbudController
style
// MARK: - UbudControllerDelegate
func statusBarHidden(in controller: UbudController) -> Bool {
return false
}
func statusBarStyle(in controller: UbudController) -> UIStatusBarStyle {
return .lightContent
}
func dismissButtonContent(in controller: UbudController) -> DismissButtonContent {
return .text("Dismiss")
}
enum ImagesPaginationStyle {
case textIndicator
case dotIndicator
}
Customize the pagination indicator style
// MARK: - UbudControllerPaginationDelegate
func imagesPaginationStyle(in controller: UbudController) -> ImagesPaginationStyle? {
return .dotIndicator
}
func imagesPaginationDidChange(in controller: UbudController, atIndex index: Int) {
/// Do anything on tapped image page content
}
Ubud is released under the MIT License.