Photo and Video Browser in ios swift 5

MediaBrowser

🏞 A simple iOS photo and video browser with optional grid view, captions and selections written in Swift5.0


      

  • language: Swift 5
  • platform: ios
  • device: iphone
  • license: MIT

Tag

Download

Introduction

🏞 MediaBrowser can display one or more images or videos by providing either UIImage objects, PHAsset objects, or URLs to library assets, web images/videos or local files. MediaBrowser handles the downloading and caching of photos from the web seamlessly. Photos can be zoomed and panned, and optional (customisable) captions can be displayed. This can also be used to allow the user to select one or more photos using either the grid or main image view.


Also, MediaBrowser use latest SDWebImage version for caching, motivated by MWPhotoBrowser

Installation

Cocoapods


pod 'MediaBrowser'

Carthage


github "younatics/MediaBrowser"


Usage

Basic

Get MediaBrowser and set MediaBrowserDelegate
let browser = MediaBrowser(delegate: self)
self.navigationController?.pushViewController(browser, animated: true)

//MediaBrowserDelegate
func numberOfMedia(in mediaBrowser: MediaBrowser) -> Int {
  return mediaArray.count
}
    
func media(for mediaBrowser: MediaBrowser, at index: Int) -> Media {
  if index < mediaArray.count {
    return mediaArray[index]
  }
  return DemoData.localMediaPhoto(imageName: "MotionBookIcon", caption: "Photo at index is Wrong")
}

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *