IRGallery-swift is a powerful gallery for iOS.

Overview

Build Status Platform

IRGallery-swift

  • IRGallery-swift is a powerful gallery for iOS.

Features

  • Captions.
  • Rotation support.
  • Load images locally or from a web URL.
  • Custom UITabBarItems.
  • Default UITabBarItems:
    • Delete.
    • Favorite.
    • Share.

Future

  • Single tap fullscreen mode.
  • Double tap image zooming.
  • Pinch zooming.

Install

Git

  • Git clone this project.
  • Copy this project into your own project.
  • Add the .xcodeproj into you project and link it as embed framework.

Options

  • You can remove the demo and ScreenShots folder.

Cocoapods

  • Add pod 'IRGallery-swift' in the Podfile
  • pod install

Usage

Basic

import IRGallery_swift

let galleryVC = IRGalleryViewController.init(photoSrc: self)
galleryVC.delegate = self
galleryVC.startingIndex = indexPath.row
galleryVC.useThumbnailView = false
galleryVC.gotoImageByIndex(UInt(indexPath.row), animated: false)
self.navigationController?.pushViewController(galleryVC, animated: true)
  • Use IRGalleryViewControllerSourceDelegate.
// MARK: - IRGalleryViewControllerDelegate
func numberOfPhotosForPhotoGallery(gallery: IRGalleryViewController) -> Int {
    return images.count
}

func photoGallery(gallery: IRGalleryViewController, sourceTypeForPhotoAtIndex index: UInt) -> IRGalleryPhotoSourceType {
    return .local
}

func photoGallery(gallery: IRGalleryViewController, captionForPhotoAtIndex index: UInt) -> String? {
    let filename = "Photo \(index + 1)"
    return filename
}

func photoGallery(gallery: IRGalleryViewController, filePathForPhotoSize size: IRGalleryPhotoSize, index: UInt) -> String? {
    let path = Bundle.main.url(forResource: images[Int(index)] as! String?, withExtension: nil)?.path
    return path
}

func photoGallery(gallery: IRGalleryViewController, urlForPhotoSize size: IRGalleryPhotoSize, index: UInt) -> String? {
    return nil
}

func photoGallery(gallery: IRGalleryViewController, isFavoriteForPhotoAtIndex index: UInt) -> Bool {
    return false
}

Advanced settings

  • Use IRGalleryViewControllerDelegate.
func photoGallery(gallery: IRGalleryViewController, deleteAtIndex index:UInt)
func photoGallery(gallery: IRGalleryViewController, addFavorite isAddToFavortieList: Bool, index: UInt)
  • Make your custome Bar Items.
var barItems: [UIBarButtonItem]

var deleteButton: UIBarButtonItem?
var favoriteButton: UIBarButtonItem?
var sendButton: UIBarButtonItem?

// create buttons for toolbar
let doDeleteButton = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 40, height: 50))
var image = UIImage.imageNamedForCurrentBundle(name: "btn_trash")
image = Utilities.image(image!, scaledToSize: CGSize.init(width: 20, height: 26.67))
doDeleteButton.setImage(image, for: .normal)
image = UIImage.imageNamedForCurrentBundle(name: "btn_trash")
image = Utilities.image(image!, scaledToSize: CGSize.init(width: 20, height: 26.67))
doDeleteButton.setImage(image, for: .highlighted)
doDeleteButton.addTarget(self, action: #selector(deleteClk), for: .touchUpInside)
self.deleteButton = UIBarButtonItem.init(customView: doDeleteButton)

let doFavoriteButton = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 40, height: 50))
image = UIImage.imageNamedForCurrentBundle(name: "btn_video_heart")
image = Utilities.image(image!, scaledToSize: CGSize.init(width: 21.4, height: 20))
doFavoriteButton.setImage(image, for: .normal)
image = UIImage.imageNamedForCurrentBundle(name: "btn_video_heart")
image = Utilities.image(image!, scaledToSize: CGSize.init(width: 21.4, height: 20))
doFavoriteButton.setImage(image, for: .highlighted)
image = UIImage.imageNamedForCurrentBundle(name: "btn_heart_h")
image = Utilities.image(image!, scaledToSize: CGSize.init(width: 21.4, height: 20))
doFavoriteButton.setImage(image, for: .selected)
doFavoriteButton.addTarget(self, action: #selector(addToMyFavoritesClk), for: .touchUpInside)
self.favoriteButton = UIBarButtonItem.init(customView: doFavoriteButton)

let doSendButton = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 40, height: 50))
image = UIImage.imageNamedForCurrentBundle(name: "btn_video_send")
image = Utilities.image(image!, scaledToSize: CGSize.init(width: 25, height: 25))
doSendButton.setImage(image, for: .normal)
image = UIImage.imageNamedForCurrentBundle(name: "btn_video_send")
image = Utilities.image(image!, scaledToSize: CGSize.init(width: 25, height: 25))
doSendButton.setImage(image, for: .highlighted)
doSendButton.addTarget(self, action: #selector(shareClk), for: .touchUpInside)
self.sendButton = UIBarButtonItem.init(customView: doSendButton)

barItems.insert(self.sendButton!, at: 0)
barItems.insert(self.favoriteButton!, at: 0)
barItems.insert(self.deleteButton!, at: 0)

...

let galleryVC = IRGalleryViewController.init(photoSrc: self, barItems: barItems)

Screenshots

List Gallery
List Gallery
Delete Favorite
Delete Favorite
Share Scale
Share Scale
Landscape
Landscape
You might also like...
Kingfisher is a powerful, pure-Swift library for downloading and caching images from the web
Kingfisher is a powerful, pure-Swift library for downloading and caching images from the web

Kingfisher is a powerful, pure-Swift library for downloading and caching images from the web. It provides you a chance to use a pure-Swift way to work

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.

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

A lightweight generic cache for iOS written in Swift with extra love for images.
A lightweight generic cache for iOS written in Swift with extra love for images.

Haneke is a lightweight generic cache for iOS and tvOS written in Swift 4. It's designed to be super-simple to use. Here's how you would initalize a J

A lightweight and fast image loader for iOS written in Swift.

ImageLoader ImageLoader is an instrument for asynchronous image loading written in Swift. It is a lightweight and fast image loader for iOS. Features

An image download extension of the image view written in Swift for iOS, tvOS and macOS.
An image download extension of the image view written in Swift for iOS, tvOS and macOS.

Moa, an image downloader written in Swift for iOS, tvOS and macOS Moa is an image download library written in Swift. It allows to download and show an

High-performance animated GIF support for iOS in Swift
High-performance animated GIF support for iOS in Swift

Gifu adds protocol-based, performance-aware animated GIF support to UIKit. (It's also a prefecture in Japan). Install Swift Package Manager Add the fo

XAnimatedImage is a performant animated GIF engine for iOS written in Swift based on FLAnimatedImage
XAnimatedImage is a performant animated GIF engine for iOS written in Swift based on FLAnimatedImage

XAnimatedImage is a performant animated GIF engine for iOS written in Swift based on FLAnimatedImage. An illustration is shown below: Features Plays m

An extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memory and disk caching for iOS and  Watch.

KFSwiftImageLoader KFSwiftImageLoader is an extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memor

Image picker with custom crop rect for iOS written in Swift (Ported over from GKImagePicker)
Image picker with custom crop rect for iOS written in Swift (Ported over from GKImagePicker)

WDImagePicker Ever wanted a custom crop area for the UIImagePickerController? Now you can have it with WDImagePicker. Just set your custom crop area a

Owner
Phil Chang
Phil Chang
Nilay Dagdemir 0 Jan 23, 2022
An iOS/tvOS photo gallery viewer, useful for viewing a large (or small!) number of photos.

This project is unmaintained. Alex passed away in an accident in late 2019. His love of iOS development will always be remembered. AXPhotoViewer AXPho

Alex Hill 596 Dec 30, 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
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
🖼 Gallery App for Actomaton (async/await + Elm Architecture) + SwiftUI.

?? Actomaton-Gallery Gallery App for Actomaton (async/await + Elm Architecture) + SwiftUI. NOTE: Most of the code are reused from Harvest-SwiftUI-Gall

Yasuhiro Inami 44 Dec 20, 2022
Applies filter to a selected image from the Gallery using Combine

CombinePhotoFiltering App CombinePhotoFiltering is an app that applies sepia and bloom to a selected picture from the Photos app. Highlights The app i

Mauricio Esteves 0 Nov 14, 2021
Gallery has a clearer flow based on albums and focuses on the use case of selecting video

Description We all love image pickers, don't we? You may already know of ImagePicker, the all in one solution for capturing pictures and selecting ima

null 1 Sep 14, 2022
Photo Gallery App demo using a REST API

Photo Gallery iOS App - (Using Rest API) A demo Photo Gallery App using a Rest API using MVVM architecture in Swift + UIKit. Overview Fully Programmat

Neel Mewada 2 Nov 22, 2021
Image gallery similar to Adidias' app, built in SwiftUI

TripleStackGallery TripleStackGallery is a image gallery component, which displays a set of images as a stack of three images, always displaying the i

Tomás Martins 5 Aug 29, 2022
A powerful new way to Reddit on iOS.

Slide for Reddit Slide is a powerful open-source, ad-free, Swift-based Reddit browser for iOS. Feel free to join us on the official subreddit for disc

Haptic Apps 460 Dec 28, 2022