I am trying to integrate Viewer library to see photos and videos from album. I have integrated everything but one. I don't understand what this line means on there github link : You'll need a collection of items that comform to the Viewable protocol.
Viewable Protocol :
public enum ViewableType: String {
case image
case video
}
public protocol Viewable {
var type: ViewableType { get }
var assetID: String? { get }
var url: String? { get }
var placeholder: UIImage { get }
func media(_ completion: @escaping (_ image: UIImage?, _ error: NSError?) -> Void)
}
And this is how we have to use this library :
extension CollectionController: ViewerControllerDataSource {
func viewerController(_ viewerController: ViewerController, viewableAt indexPath: IndexPath) -> Viewable {
return photos[indexPath.row]
}
}
In this extension we have to return Viewable and thats my problem. I have PHAssets but need to make Viewable type. How to do it ?
For reference check Viewer library : https://github.com/bakkenbaeck/Viewer
Any help would be appreciated.
I believe you'll need something like below:
or you may create your own class: