Giter VIP home page Giter VIP logo

viewer's Introduction

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.

viewer's People

Contributors

3lvis avatar aktasmuhammet avatar amefuri avatar askeland avatar bwised avatar elland avatar marijnschilling avatar mronus avatar petrovi4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

viewer's Issues

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.

Bug in collection view offset

Steps to reproduce:
1.- Select the last cell in portrait mode
2.- Rotate your device to landscape mode
3.- Rotate it back to portrait

Expected results:
Everything goes back to where it was before step 1.

Current results:
All the collection view is offset by several pixels

rotation-bug3

Hidden cell gets unhidden when rotating device

Steps to reproduce:
1.- Select photo
2.- Rotate
3.- Dismiss

Expected:
When dismissing the photo selected on step 1 should be hidden

Current:
When dismissing the photo selected on step 1 is visible

bug

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

Warning when loading videos

2016-01-26 16:43:07.610 iOS[34694:2279593] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

Conforming to Viewable?

apologies as this is more of a "how-to"....I have an imageURL string, how can I conform to the Viewable protocol?

How do you make a Viewable?

Sorry to post as an issue but I don't understand how you make my array of URLs into an array of Viewables.

images missing using cocoapods

The framework seems to complain that i'm missing the following images in my assets. I installed via cocoapods:

-dark-circle
-play
-pause
-repeat

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?

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?

Problem with hiding video controls

Steps to reproduce (needs autoplay enabled)

  • Open video
  • Starts playing, controls hide
  • Press to show controls
  • Drag as if you were to dismiss but put it back

Expected

  • Continues playing with all the controls being displayed

Current

  • Header and footer controls get hidden, pause button and video progress are still there

Disable header and footer interactions when swipping

Swiping an image should disable interactions with other buttons until interaction is finished, otherwise is not very clear which element should be dismissed.

iOS's Photos app: Just dismisses the original image
Carousel: Similar to iOS photos but tries to be smart about which image should be dismissed, it also crashes most of the time
Google Photos: Disables interactions with other elements until interaction is finished

Status bar hiding problem

  • Pick a photo
    (Goes in full screen)
  • Press the middle of the photo
    (UI/buttons hide)
  • Drag the screen down like dismissing it, but don't dismiss it, return it to it's original position

Expected:
Since all the UI, buttons and status bar was hidden, then when returning the photo to it's original position, then the status bar should be hidden.

Current:
All UI is hidden, but the status bar is visible.

Video rotation issue

if video is playing and that moment we lock and unlock the phone and rotate the video , in that case video does not work.

Using View doesn't let xcode run : Viewer Issue

Hello,

I have tried installing viewer using cocoapods and by coping main source file. But none of them is working.
Whenever i am trying to build the project, xcode is getting crashed. After removing Viewer that didn't happen. So because of this i am unable to use viewer.
Please look into this issue and provide some guidation.
Thanks.

Add support for tvOS

Right now UIScrollView pagination is not working, hence, support for tvOS is not available.

Go to the next page, then go back again disables dismissal

Steps to reproduce:

1.- Open a photo in full screen mode
2.- Go to the next, but not all the way, then go back
3.- Swipe item down to dismiss

Current result:
Item doesn't respond to swipe

Expected result:
Swiping down dismisses the item

next-bug

Dragging dismissal

When opening full screen, I would like to drag the screen down and up to dismiss the image.

Refactor for ViewableController reuse

Right now is creating one viewer item controller per item, this is terrible.

It should have a buffer of 10 and reuse those controllers once they go offscreen.

Zooming rotation bug

Found an issue when rotating the screen here are some steps to reproduce it:

  • Rotate to from portrait to landscape
  • Zoom in
  • Rotate back to portrait
  • Zoom back

Exposed background

When scrolling fast the background gets exposed, in this gif located in the right area.

sample2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.