A modern photo viewing experience for iOS.

Related tags

Image NYTPhotoViewer
Overview

NYTPhotoViewer

Platform Version Carthage compatible

NYTPhotoViewer is a slideshow and image viewer that includes double-tap to zoom, captions, support for multiple images, interactive flick to dismiss, animated zooming presentation, and more.

Demo GIF

Usage

Usage is simple, with the option for more complicated customization when needed through a delegate relationship. In the most basic implementation, just initialize the view controller with an array of photo objects and present it as normal:

NYTPhotosViewController *photosViewController = [[NYTPhotosViewController alloc] initWithPhotos:photos];
[self presentViewController:photosViewController animated:YES completion:nil];

Running the Example

Clone this locally, then in your local workspace of the NYTPhotoViewer repo, run ./scripts/bootstrap, then open Examples/NYTPhotoViewer.xcworkspace. You'll see targets for a Swift and Objective-C app.

Installation

Swift Package Manager

NYTPhotoViewer may be installed via SPM, by pointing at this repo's URL.

Cocoapods

NYTPhotoViewer is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'NYTPhotoViewer'

Carthage

NYTPhotoViewer may be installed via Carthage. To install it, simply add the following line to your Cartfile:

github "NYTimes/NYTPhotoViewer"

Then, following the instructions for integrating Carthage frameworks into your app, link the NYTPhotoViewer and PINRemoteImage frameworks into your project.

If you don't want support for animated GIFs, you may instead link against only the NYTPhotoViewerCore framework.

Requirements

This library requires a deployment target of iOS 9.0 or greater.

Changelog

See CHANGELOG.md.

Contributing

Please open pull requests against the develop branch, and add a relevant note to the develop section of the CHANGELOG as part of your pull request.

Swift

NYTPhotoViewer is written in Objective-C but is fully interoperable with Swift. If you experience any interoperability difficulties, please open an issue or pull request and we will work to resolve it.

Inspiration

NYTPhotoViewer draws feature inspiration from Facebook and Tweetbot’s image viewers. If this implementation isn’t to your liking, you may consider JTSImageViewController or IDMPhotoBrowser.

Implementation

NYTPhotoViewer has a straightforward implementation using standard UIKit components. The viewer is a UIViewController and uses UIViewController transitioning APIs for the animated and interactive transitions, a UIPageViewController for horizontal swiping between images, and UIScrollView for image zooming.

It is intended to be used without the need for subclassing, and as such it accepts model objects conforming to a NYTPhoto protocol and provides ample opportunity for customization via the NYTPhotosViewControllerDelegate. Since standard APIs are used, the client has full control over the transitions and customization of the NYTPhotosViewController.

License

NYTPhotoViewer is available under the Apache 2.0 license. See LICENSE.md for more information.

Contributors

A list of contributors is available through GitHub.

Comments
  • Initial Pull Request for Review

    Initial Pull Request for Review

    This pull request adds all the files for a first review of the photo pod.

    It includes the sample project and pod files, and fully documented public interfaces for all objects. The project also supports iOS 7 (boooooo) and iOS 8. It so far only includes unit tests for NYTPhotosViewController. Since this includes many files, I'd recommend opening up the workspace and looking at the class files there.

    The entire pod starts with NYTPhotosViewController, which is intended to be the only class that clients will be dealing with. If I could make every other class private, I would.

    There are a couple things that are not yet supported, like working with a push transition or client hiding of the status bar. These may or may not be in the first pod release, but also are the lowest priority.

    opened by bcapps 20
  • [HACK WEEK] Example Swift App with UI and Unit Test targets [SWIFT 1.1, Xcode 6.2 rel]

    [HACK WEEK] Example Swift App with UI and Unit Test targets [SWIFT 1.1, Xcode 6.2 rel]

    Demonstrates use of NYTPhotoViewer from an app written in Swift with UI and unit tests

    • Note that this PR includes a workaround for the iPad issue in which tapping Share from the built-in NYTPhotosViewController causes a crash. Although the crasher will be fixed in the underlying pod, the workaround provides a simple demonstration of passing a closure that would otherwise be unnecessary.
    • Minimum deployment target is 8.2 (current release as of initial pull request).
    • This version supports the Swift 1.1 feature set (using a singleton for the provider) avoiding language improvements still in beta.
    • Requires Xcode 6.2 release SDK to build and run. Clone this repo, open the workspace under the Example folder and set the scheme to NYTPhotoViewer-Swift.
    opened by mpkeefe 13
  • Fix #341 - restore support for animated gifs

    Fix #341 - restore support for animated gifs

    Added 2nd Target

    (avoiding the '[target 2] has source overlapping sources' problem with a symlink)

        targets: [
            .target(
                name: "NYTPhotoViewer",
                path: "NYTPhotoViewer"
            ),
            .target(
                name: "NYTPhotoViewerGIF",
                dependencies: ["PINRemoteImage"],
                path: "SourceSymLink",
                cSettings: [
                  .define("ANIMATED_GIF_SUPPORT", to: "1")
                ]
            )
        ]
    

    Tweaked imports in 3 files by changing

    #import <PINRemoteImage/FOO.h>
    

    to

    #if SWIFT_PACKAGE
      #import "FOO.h"
    #else
      #import <PINRemoteImage/FOO.h>
    #endif
    
    opened by mr-fixit 12
  • Carthage support

    Carthage support

    Adds Carthage support by:

    • Adding a framework scheme and sharing it
    • Adding a bridging header which includes
    #import <NYTPhotoViewer/NYTPhotosViewController.h>
    #import <NYTPhotoViewer/NYTPhoto.h>
    #import <NYTPhotoViewer/NYTPhotosOverlayView.h>
    
    • Creating a symlink to the pods project file in the root directory.

    Related Issues

    • Closes #61
    • Closes #62
    opened by MichaelSelsky 10
  • Broken on Cocoapods 1.0.0 beta 6

    Broken on Cocoapods 1.0.0 beta 6

    I am hoping to start a conversation here so that we can direct this at the cocoapods team, but right now using the latest beta NYTPhotoViewer doesn't build and instead outputs the following error:

    error: /Users/Path/To/Build/Products/Debug-iphonesimulator/NYTPhotoViewer/NYTPhotoViewer.bundle: No such file or directory
    

    This works on the latest release of cocoapods (0.39.0 I think) but on the betas its broken.

    It seems to me that cocoapods has broken the usage of resource_bundle (used here) in the new releases.

    Funnily enough Google use the resources property (here) and this seems to be working.

    I will submit a bug with cocoapods but I thought it should have visibility here too

    opened by danielgalasko 9
  • Version 2.0.0 not installing

    Version 2.0.0 not installing

    When I try to install it through cocoa pods it says NYTPhotoViewer(1.2.0) as the latest version?

    Has it come through on to the cocoaPods server yet if there is one?

    opened by OscarGorog 8
  • Respect Safe Area Layout Guide

    Respect Safe Area Layout Guide

    What it does

    Respects the safe area layout guide for the caption view and the top items (https://github.com/NYTimes/NYTPhotoViewer/issues/246).

    Thanks so much to @matthiaskmt for submitting this PR: https://github.com/NYTimes/NYTPhotoViewer/pull/247. We decided to go a slightly different route by adding a delegate method photosViewController:captionViewRespectsSafeAreaForPhoto: to allow the client to choose if they want their caption view to adhere to the safe area insets. If a caption has a background view the client may want those colors/gradients/etc. to extend to the edges of the screen.

    opened by alexbrashear 8
  • Move content under statusBar if prefersStatusBarHidden is false

    Move content under statusBar if prefersStatusBarHidden is false

    Allow developers to show the status bar with navigation bar buttons without overlaps. If gallery is showed with visible status bar the navigation buttons overlaps it, with this small change you can set to move content origin under status bar to prevent it.

    Before: captura de pantalla 2016-11-24 a las 15 50 47

    After: captura de pantalla 2016-11-24 a las 15 49 44

    Code:

    private class PhotosViewController: NYTPhotosViewController {
        override var prefersStatusBarHidden: Bool {
            return false
        }
        
        override var preferredStatusBarStyle: UIStatusBarStyle {
            return .lightContent
        }
    }
    
    let viewer = PhotosViewController(photos: [photo], initialPhoto: photo, delegate: nil)
    viewer.underStatusBar = true
    self.present(viewer, animated: true, completion: nil)
    
    opened by sergiog90 8
  • Close Button Missing

    Close Button Missing

    Steps to Reproduce

    1. Run either of the sample projects.
    2. Tap the photo.

    Expected Results

    An “X” button called NYTPhotoViewerCloseButtonX is displayed in the upper left corner of the view controller.

    Actual Results

    No “X” button is displayed and the nyt_photoViewerResourceBundle method returns nil.

    Platform and OS

    Tested both Swift 2 (with minor changes to get it to compile) and Objective-C sample projects as well as another project.

    Xcode Version 7.2 (7C68)

    bug 
    opened by mattbischoff 8
  • Life cycle some methods delegation.

    Life cycle some methods delegation.

    Added viewWillAppear:animated and viewWillDisappear:animated to delegate. Now you can control status bar hidded state if you present from UINavigationController and prevent close and share buttons overlap.

    opened by sergiog90 7
  • Add support for Swift Package Manager v. 5.3

    Add support for Swift Package Manager v. 5.3

    Add support for Swift Package manager by adding a package manifest and creating a few symlinks where the current directory structure of the project was a bit inconvenient or even incompatible with representation in the package manifest.

    This requires version 5.3 of the package manager in order to fully support this project including the bundled images.

    Closes https://github.com/nytimes/NYTPhotoViewer/issues/332.

    opened by mattpolzin 6
  • Localization

    Localization

    Hello, we're localizing our app and we'd like to extend that to NYTPhotoViewer. It doesn't look like it would be much work, you're already using NSLocalizedString(). We could contribute to this effort. Are you interested?

    opened by murraysagal 1
  • Unable to run on iOS 12 in 5.0.8

    Unable to run on iOS 12 in 5.0.8

    We add NYTPhotoViewer using Cocopods and in 5.0.8 appeared an issue during application launch

    dyld: Library not loaded: /System/Library/Frameworks/LinkPresentation.framework/LinkPresentation
      Referenced from: XXXX/Frameworks/NYTPhotoViewer.framework/NYTPhotoViewer
      Reason: image not found
    
    opened by Igor-Palaguta 0
  • Migrating to SPM

    Migrating to SPM

    We're switching from cocoapods to SPM. Added the package...

    Screenshot 2022-11-11 at 4 36 39 PM

    But I'm getting this. The NYTScalingImageView.m file looks fine to me. The @interface declaration is there above the @implementation. I'm not sure what's missing. Any ideas? Screenshot 2022-11-11 at 4 32 33 PM

    opened by murraysagal 4
  • Crash when clicking to disappear in landscape orientation If super Controller only supports UIInterfaceOrientationMaskPortrait

    Crash when clicking to disappear in landscape orientation If super Controller only supports UIInterfaceOrientationMaskPortrait

    *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'preferredInterfaceOrientationForPresentation 'landscapeRight' must match a supported interface orientation: 'portrait'!' 111667353716_ pic

    opened by wangwei123456 0
  • iOS 15 Nav Appearance Updates Remove Transparent Navigation Bar in photo viewer

    iOS 15 Nav Appearance Updates Remove Transparent Navigation Bar in photo viewer

    The navigation bar in the overlayView is using the global values I set in my AppDelegate, but only in iOS 15. My AppDelegate:

    if #available(iOS 13.0, *) {
                let ap = UINavigationBarAppearance()
                ap.backgroundColor = UIColor.HBlue()
                ap.titleTextAttributes = convertToOptionalNSAttributedStringKeyDictionary([NSAttributedString.Key.foregroundColor.rawValue: UIColor.white, NSAttributedString.Key.font.rawValue: Constants.Fonts.NavigationItemTitleFont!])!
                UINavigationBar.appearance().scrollEdgeAppearance = ap
                UINavigationBar.appearance().standardAppearance = ap
    }
            UINavigationBar.appearance().isTranslucent = false
    

    I've seen this issue, but it's recommended solution didn't work for me. iOS 15 introduces some different changes to UINavigationBar's appearance and I believe that's causing this issue.

    Any workaround for this so that the navigation bar on the photo viewer remains transparent?

    The issue: Simulator Screen Shot - iPhone 12 - 2022-02-02 at 15 21 52

    opened by justColbs 2
Releases(5.0.8)
  • 5.0.8(Oct 31, 2022)

  • 5.0.7(Oct 24, 2022)

    Changes for users of the library currently on 5.0.7:

    • fixed caption overlay placement
    • fixed overlay view buttons tint color
    • added summary to share

    The CocoaPod version is known to work, the SPM version probably doesn't build due to a PINRemoteImage problem.

    Source code(tar.gz)
    Source code(zip)
  • 5.0.4(Sep 18, 2020)

  • 5.0.3(Aug 10, 2020)

  • 5.0.2(Apr 29, 2020)

    • Restore a method that was accidentally removed in 5.0.0. This prevented a long-tap guesture from displaying the 'Copy' menu.
    • Remove obsolete check for iOS 8.3.
    Source code(tar.gz)
    Source code(zip)
  • 5.0.1(Apr 28, 2020)

  • 5.0.0(Apr 28, 2020)

    • Changed NYTPhotosViewControllerDelegate protocol so that - photosViewController:interstitialViewAtIndex: can return nil. If it does, that index is skipped and the following (or preceding) photo or interstitial view is displayed.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.1(Mar 30, 2020)

    • Removed FLAnimatedImage from .gitmodules.
    • Change NYTPhotosViewController to use fullscreen presentation by default, so it causes the presenting view to disappear behind it, i.e. to get -viewWillDisappear: and -viewDidDisappear: called on it.
    • Fix unbalanced calls to begin/end appearance transitions.
    • Modified comment parameter in NYTPhotosViewController and NYTPhotoViewerSinglePhotoDataSource to match parameter in signature. Removes compilation warning.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0(Mar 18, 2020)

    • Update deployment target to 9.0 from 8.0
    • Remove property UIPopoverController *activityPopoverController from NYTPhotosViewController
    • Replace use of FLAnimatedImage with PINRemoteImage (https://github.com/pinterest/PINRemoteImage) because FLAnimatedImage is no longer maintained and contains deprecated code.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.1(Dec 5, 2019)

  • 3.0.0(Oct 7, 2019)

  • 2.0.0(Dec 11, 2017)

    • Expose a data-source-oriented API for PhotosViewController (#226)
      • A data source no longer has to handle out-of-bounds indexes (#227)
      • The data source is not retained (#227)
    • Respect safe areas for iOS 11 support
    Source code(tar.gz)
    Source code(zip)
  • 1.2.0(Aug 19, 2016)

    Changes for users of the library in 1.2.0:

    • Add Carthage support (#164, #167), (#171)
    • Fix gradient flickering of caption view on iOS 9 (#166)
    • Readd loading view when photo source is set back to nil (#187)
    • Include all files in the bundle, not just PNGs, in Cocoapods resource bundle (#170)
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Feb 3, 2016)

    Changes for users of the library in 1.1.0:

    • Add a delegate method to allow customizing navigation bar title text (#142, #151, #154)
    • Add documentation clarifying NYTPhoto.image vs .imageData properties; add a warning if you’re doing something wrong (#153)
    • Add delegate to the designated initializer (#155)
    • Fix overlay view animating out and back when a view controller presented atop NYTPhotosViewController is dismissed (#156)
    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Jan 26, 2016)

    Changes for users of the library in 1.0.1:

    • Fixes for incorrect logic determining whether to send delegate messages about PhotosViewController dismissal (#130, #137)
    • Avoid testing floats for equality in PhotoViewController (#135)
    • Fix orientation issue with reference view of type UIImageView (#116, #145)
    • Avoid applying a hacky iOS status bar bugfix on iOS 8.3+ (it appears to have been fixed then) (#131)
    • Removed redundant Swift unit tests (#128)
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Jan 13, 2016)

    Changes for users of the library in 1.0.0:

    • The library now supports iOS 8.0 and newer. (#82, #84, #107)
    • Support programmatic view controller dismissal via dismissViewControllerAnimated:completion: (#121, #122)
    • Use scrolling UITextView for captions (#88)
    • Fix a bug when presenting NYTPhotoViewer from a subview of UIStackView (#104)
    • Update overlay information after displayPhoto: call (#100)
    • Implements animated GIF support (#71, #94, #106, #111)
    • Fix misplacing view position while zoom transition (#89)
    • Adopt CocoaPods resource_bundles and fix resource image loading (#80, #113, #123)
    • Use iOS 8 UIActivityViewController.completionWithItemsHandler API (#82)
    • Nullability and lightweight generics annotations on important public API (#83, #98)
    • Fix circular reference of NYTPhotosViewController (#79)
    • Set barButtonItem on popover UIActivityViewControllers (#65)
    • Accept Xcode 7 build settings and fix Xcode 7 warnings (#76)
    • Ensure our nav bar will always be translucent with no tint color (#57)
    • Fix crash on tapping Share button on iPad (#52)
    • Allow customizing maximum photo zoom scale(#51)
    • Rename …didDisplayPhoto… delegate method to …didNavigateToPhoto… (#47)
    • Adds support for setting rightBarButtonItems and leftBarButtonItems on NYTPhotosViewController (#49)
    Source code(tar.gz)
    Source code(zip)
  • 0.1.2(Mar 27, 2015)

  • 0.1.1(Mar 20, 2015)

  • 0.1.0(Mar 16, 2015)

A photo gallery for iOS with a modern feature set. Similar features as the Facebook photo browser.

EBPhotoPages ”A photo gallery can become a pretty complex component of an app very quickly. The EBPhotoPages project demonstrates how a developer coul

Eddy Borja 1.7k Dec 8, 2022
Jogendra 113 Nov 28, 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
React-native-photo-editor - Photo editor using native modules for iOS and Android

?? Image editor using native modules for iOS and Android. Inherit from 2 available libraries, ZLImageEditor (iOS) and PhotoEditor (Android)

Baron Ha. 244 Jan 5, 2023
FMPhotoPicker is a modern, simple and zero-dependency photo picker with an elegant and customizable image editor

FMPhotoPicker is a modern, simple and zero-dependency photo picker with an elegant and customizable image editor Quick demo Batch select/deselect Smoo

Cong Nguyen 648 Dec 27, 2022
DGCropImage - A photo cropping tool which mimics Photo.app written by Swift

DGCropImage A photo cropping tool which mimics Photo.app written by Swift. This

donggyu 11 Jul 14, 2022
Photo-Sharing-App - Photo Sharing App With Swift

Photo Sharing App You can register and log in to this application and share your

Yağız Savran 2 Jun 14, 2022
Lightweight iOS Photo Blur App

Blurry Blurry is the go-to image blurring tool to help you apply beautiful blurs for your photos. It is perfect for creating wallpapers, backgrounds,

Andy 17 Nov 22, 2022
This simple cordova plugin will download picture from an URL and save to IOS Photo Gallery.

Photo Viewer This plugin is intended to download a picture from an URL into IOS Photo library.. How to Install Cordova: cordova plugin add https://git

Alwin jose 1 Oct 23, 2021
An image cropper / photo cropper for iOS like in the Contacts app with support for landscape orientation.

RSKImageCropper An image cropper for iOS like in the Contacts app with support for landscape orientation. Installation RSKImageCropper requires iOS 9.

Ruslan Skorb 2.4k Jan 5, 2023
iOS photo gallery written in Swift

SwiftPhotoGallery Overview A full screen photo gallery for iOS and tvOS written in Swift. Photos can be panned and zoomed (iOS only) Pinch to zoom (iO

Justin Vallely 271 Dec 17, 2022
A simple iOS photo and video browser with grid view, captions and selections.

MWPhotoBrowser A simple iOS photo and video browser with optional grid view, captions and selections. MWPhotoBrowser can display one or more images or

Michael Waterfall 8.8k Dec 27, 2022
Custom iOS camera and photo picker with editing capabilities

Overview Paparazzo is a component for picking and editing photos. Key Features ?? Taking photos using camera ?? Picking photos from user's photo libra

avito.tech 757 Jan 4, 2023
A random photo generator from unsplash for iOS

Random Photo App for IOS How it works It is a random photo generator from unsplash. Everytime you press the button, a random photo appears and the bac

Stefan Istoc 2 Feb 2, 2022
WLPhotoPicker - A multifunction photo picker for iOS

WLPhotoPicker Example To run the example project, clone the repo, and run pod in

Weang 20 Nov 25, 2022
Nilay Dagdemir 0 Jan 23, 2022
FacebookImagePicker is Facebook album photo picker written in Swift.

Features • Installation • Usage • Translation • License GBHFacebookImagePicker is Facebook's album photo picker written in Swift, built to provide a s

Florian Gabach 231 Dec 17, 2022
TripUp is an open source, photo storage and sharing app made for privacy conscious users.

TripUp is an open source, photo storage and sharing app made for privacy conscious users.

TripUp 19 Aug 26, 2022
Turn a photo of your food into a face

Megabite Megabite is a mobile app that automatically turns a photo of your food into a face. Read more about it here. Installation This project uses C

Aaron Randall 361 Oct 26, 2022