Image viewer (or Lightbox) with support for local and remote videos and images

Overview

Viewer

Table of Contents

Features

Focus

Select an image to enter into lightbox mode.

Browse

Open an image or video to browse.

Rotation

Portrait or landscape, it just works.

Zoom

Pinch-to-zoom works seamlessly in images.

tvOS

Support for the Apple TV.

Setup

You'll need a collection of items that comform to the Viewable protocol. Then, from your UICollectionView:

import Viewer

override public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
    guard let collectionView = self.collectionView else { return }

    let viewerController = ViewerController(initialIndexPath: indexPath, collectionView: collectionView)
    viewerController.dataSource = self
    presentViewController(viewerController, animated: false, completion: nil)
}

extension CollectionController: ViewerControllerDataSource {
    func viewerController(_ viewerController: ViewerController, viewableAt indexPath: IndexPath) -> Viewable {
        return photos[indexPath.row]
    }
}

Installation

CocoaPods

pod 'Viewer'

Carthage

github "3lvis/Viewer"

License

Viewer is available under the MIT license. See the LICENSE file for more info.

Comments
  • Fix: Collection view focus

    Fix: Collection view focus

    Viewer currently wasn't handling focus quite well changing the focus of the selected cell when you swipe between viewable objects, this PR aims to fix that.

    Before

    before

    After

    after

    opened by 3lvis 8
  • Video is not working

    Video is not working

    Hi,

    I am using this library to show photos and videos, photos are working fine but video is not. All i can hear the audio with image but no audio. Any idea why this is happening ? Same video is working in Viewer sample code. I am using pod version of viewer.

    opened by skdevil 6
  • video progress

    video progress

    Shows the progress of the video that is displayed

    Some issues are:

    • What to do when the movie is in portraitmode? Show the porgress or not?
    • What to do when the movie is very light, it can be hard to see the white letters and stripe
    • I'd like to make the progress smooth, but how... ๐Ÿค”
    opened by marijnschilling 5
  • Swift 5.0 compatibility

    Swift 5.0 compatibility

    I'm pulling from 'https://github.com/3lvis/Viewer.git', :commit => 'baaf8ca0c3e93c3a08288c1bdf52116444d20ee8', which seems to work but would be nice to pull from release.

    opened by RobSwish 4
  • Activate sound when the volume is changed (even in silent mode)

    Activate sound when the volume is changed (even in silent mode)

    Activate sound when the volume is changed even if phone is in silent mode (kind of like Snapchat). This is reset when video is closed, so volume must be changed again when new video starts if the user wants sound

    opened by askeland 4
  • video play icon not hidden swipe back when

    video play icon not hidden swipe back when "video autoplay" true.

    Hi! That's really a great library. i just post this issue(inform) here because of you make this library much better. i am using Xcode 11.0 and swift 4.0 or above. i am getting issue when i used local option on your demo and also my project.

    opened by DixPatel009 3
  • Improve slowmotion handling

    Improve slowmotion handling

    Finally, got this crap working after talking to a couple of engineers at WWDC. The requestPlayerItem should configure the playerItem to play slow motion without problems, just had to change some of the options for the request.

    opened by 3lvis 3
  • Carthage: Skipped building Viewer due to the error

    Carthage: Skipped building Viewer due to the error

    Most recent version can not be build by Carthage: *** Skipped building Viewer due to the error: Dependency "Viewer" has no shared framework schemes

    If you believe this to be an error, please file an issue with the maintainers at Optional("https://github.com/bakkenbaeck/Viewer/issues/new")

    opened by wousser 3
  • How can we know which Viewable object the user has initiated an action for in the footer / header?

    How can we know which Viewable object the user has initiated an action for in the footer / header?

    If the user can change from the initialIndexPath, how do we know which Viewable object a header / footer action is occurring? Say I wanted to favorite or delete an photo as in the example, how do we know which photo this is happening to?

    opened by rob-burrus 2
  • iOS compile error on VideoView.swift

    iOS compile error on VideoView.swift

    Using Cocoapods with version 3.0.0 Compile error on line 27 https://github.com/bakkenbaeck/Viewer/blob/master/Source/VideoView.swift#L27

            #if os(tvOS)
                playerLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill
            #else
                playerLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill <<< 
            #endif
    

    Error :

    Type 'AVLayerVideoGravity' (aka 'NSString') has no member 'resizeAspectFill'

    opened by doraeminemon 2
  • Some performance issues during paginating

    Some performance issues during paginating

    Hi! First of all thanks for a great library! I found some small issue while paginating between photos. It's seems like when changing current indexPath, there's some image request appears, so viewer lags a little bit and photo blinks.

    I attached small video for demonstration. https://www.dropbox.com/s/v7tmu0w7n2kzn09/viewer_bug.mp4?dl=0

    opened by seidju 2
  • Crash on orientation change

    Crash on orientation change

    Describe the bug Example app crashes in certain circumstances with orientation change, but believe is not regarding example code.

    To Reproduce Steps to reproduce the behavior:

    1. Run app in landscape mode
    2. Click on an image
    3. Rotate (tested in Simulator) to another orientation
    4. See error

    iOS Version (please complete the following information):

    • iOS 14.5

    Additional context *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 195]. Layer: <CALayer:0x600000c37600; position = CGPoint (1266 195); bounds = CGRect (0 0; 844 390); delegate = <UIImageView: 0x7ffe08322d70; frame = (844 0; 844 390); opaque = NO; autoresize = W+H; gestureRecognizers = <NSArray: 0x6000003996e0>; layer = <CALayer: 0x600000c37600>>; allowsGroupOpacity = YES; backgroundColor = <CGColor 0x600002f9e5d0> [<CGColorSpace 0x600002894d20> (kCGColorSpaceICCBased; kCGColorSpaceModelMonochrome; Generic Gray Gamma 2.2 Profile; extended range)] ( 0 0 )>'

    Occurs at imageView.frame = CGRect(origin: CGPoint.zero, size: realImageViewSize) of ViewableController

    opened by vincentneo 1
  • Landscape mode issue: Extra scroll area shown

    Landscape mode issue: Extra scroll area shown

    Steps to reproduce:

    1. Double tap image in portrait mode to zoom
    2. Move the device to landscape mode
    3. Press and move the image , there is large extra black area shown Screenshot 2020-12-08 at 12 27 49 PM
    opened by userSV 1
  • Missing loading indicator and dismiss icon

    Missing loading indicator and dismiss icon

    There is no loading indicator while the image is being loaded so the user simply sees a black screen.

    Also, there is no visible dismiss/close icon to dismiss the view, I understand that you can drag-down to dismiss but that is simply not intuitive enough.

    Is there a way to enable a loading indicator and dismiss icon?

    opened by rigaldamez 3
  • Using without collection view

    Using without collection view

    Hi! That's really a great library, i think the only one, which gave ability to customize header/footer view. The only thing that it missed - ability to show photos without collection view. What do you think about adding that functionality?

    opened by Xpressive 11
Releases(4.3.0)
Owner
Nes
Previously world-class engineer, now figuring out my way in management.
Nes
Media view which subclasses UIImageView, and can display & load images, videos, GIFs, and audio and from the web, and has functionality to minimize from fullscreen, as well as show GIF previews for videos.

I've built out the Swift version of this library! Screenshots Description ABMediaView can display images, videos, as well as now GIFs and Audio! It su

Andrew Boryk 80 Dec 20, 2022
Agrume - ๐Ÿ‹ An iOS image viewer written in Swift with support for multiple images.

Agrume An iOS image viewer written in Swift with support for multiple images. Requirements Swift 5.0 iOS 9.0+ Xcode 10.2+ Installation Use Swift Packa

Jan Gorman 601 Dec 26, 2022
DTPhotoViewerController - A fully customizable photo viewer ViewController to display single photo or collection of photos, inspired by Facebook photo viewer.

DTPhotoViewerController Example Demo video: https://youtu.be/aTLx4M4zsKk DTPhotoViewerController is very simple to use, if you want to display only on

Tung Vo 277 Dec 17, 2022
Photo Browser / Viewer inspired by Facebook's and Tweetbot's with ARC support, swipe-to-dismiss, image progress and more

IDMPhotoBrowser IDMPhotoBrowser is a new implementation based on MWPhotoBrowser. We've added both user experience and technical features inspired by F

Thiago Peres 2.7k Dec 21, 2022
AsyncImage before iOS 15. Lightweight, pure SwiftUI Image view, that displays an image downloaded from URL, with auxiliary views and local cache.

URLImage URLImage is a SwiftUI view that displays an image downloaded from provided URL. URLImage manages downloading remote image and caching it loca

Dmytro Anokhin 1k Jan 4, 2023
Using remote images in an application is more or less a requirement these days.

Imaginary Table of Contents Description Usage Basic Advanced Configuration ImageFetcher Installation Description Using remote images in an application

HyperRedink 597 Nov 8, 2022
Swift image slideshow with circular scrolling, timer and full screen viewer

?? ImageSlideshow Customizable Swift image slideshow with circular scrolling, timer and full screen viewer ?? Example To run the example project, clon

Petr Zvonรญฤek 1.7k Dec 21, 2022
A snappy image viewer with zoom and interactive dismissal transition.

A snappy image viewer with zoom and interactive dismissal transition. Features Double tap to zoom in/out Interactive dismissal transition Animate in f

Lucas 421 Dec 1, 2022
Slide image viewer library similar to Twitter and LINE.

Overview You can use it simply by passing the necessary information! Serrata is a UI library that allows you to intuitively view images. Features King

Takuma Horiuchi 324 Dec 9, 2022
A snappy image viewer with zoom and interactive dismissal transition.

A snappy image viewer with zoom and interactive dismissal transition. Features Double tap to zoom in/out Interactive dismissal transition Animate in f

Lucas 421 Dec 1, 2022
Image slide-show viewer with multiple predefined transition styles, with ability to create new transitions with ease.

ATGMediaBrowser ATGMediaBrowser is an image slide-show viewer that supports multiple predefined transition styles, and also allows the client to defin

null 200 Dec 19, 2022
An image viewer ร  la Twitter

For the latest changes see the CHANGELOG Install CocoaPods pod 'ImageViewer' Carthage github "Krisiacik/ImageViewer" Sample Usage For a detailed examp

Kristian Angyal 2.4k Dec 29, 2022
Jogendra 113 Nov 28, 2022
A crop, compression, resize and trimming library for videos, based on AVKit.

VideoKit VideoKit is a high level layer on top of AVKit How it works // With this config, the video will get resized to 1920x1080p, the maximal length

Knoggl 9 Dec 24, 2022
A high-performance image library for downloading, caching, and processing images in Swift.

Features Asynchronous image downloader with priority queuing Advanced memory and database caching using YapDatabase (SQLite) Guarantee of only one ima

Yap Studios 72 Sep 19, 2022
WhiteAndFluffyTest - Scroll images and add them to your favourites via image page

Image service application Scroll images and add them to your favourites via imag

Ruben Egikian 0 Feb 4, 2022
High Quality Image ScrollView using cropped tiled images.

THTiledImageView Feature ?? THTiledImageView fully support UIScrollView. You can subclass it and use it. ?? Support Async Image Downloading & Caching.

null 28 Oct 28, 2022
React-native-image-generator - Library to generate images from layers

react-native-image-generator Library for generate images from other images Insta

Evgeny Usov 13 Nov 16, 2022
FlaneurImagePicker is an iOS image picker that allows users to pick images from different sources (ex: user's library, user's camera, Instagram...). It's highly customizable.

FlaneurImagePicker is a highly customizable iOS image picker that allows users to pick images from different sources (ex: device's library, device's c

FlaneurApp 17 Feb 2, 2020