All Projects → pigfly → A_j_full_screen_image_browser

pigfly / A_j_full_screen_image_browser

Licence: mit
High Performance Full Screen Image and Video browser in iOS

Programming Languages

swift
15916 projects
swift4
162 projects

Projects that are alternatives of or similar to A j full screen image browser

Hpipm
High-performance interior-point-method QP solvers
Stars: ✭ 164 (-23%)
Mutual labels:  high-performance
Activej
ActiveJ is an alternative Java platform built from the ground up. ActiveJ redefines web, high load, and cloud programming in Java, featuring ultimate performance and scalability!
Stars: ✭ 183 (-14.08%)
Mutual labels:  high-performance
Libflame
High-performance object-based library for DLA computations
Stars: ✭ 197 (-7.51%)
Mutual labels:  high-performance
Finshir
💫 An asynchronous Low & Slow traffic generator, written in Rust
Stars: ✭ 168 (-21.13%)
Mutual labels:  high-performance
Aero
🚄 Fastest node.js framework. Go version is actively maintained: @aerogo
Stars: ✭ 181 (-15.02%)
Mutual labels:  high-performance
Pond
Minimalistic and High-performance goroutine worker pool written in Go
Stars: ✭ 187 (-12.21%)
Mutual labels:  high-performance
Haproxy
HAProxy Load Balancer's development branch (mirror of git.haproxy.org)
Stars: ✭ 2,463 (+1056.34%)
Mutual labels:  high-performance
Cms
GleezCMS - A Light, Simple, Flexible Content Management System
Stars: ✭ 200 (-6.1%)
Mutual labels:  high-performance
Collapse
Advanced and Fast Data Transformation in R
Stars: ✭ 184 (-13.62%)
Mutual labels:  high-performance
Threadly
A library of tools to assist with safe concurrent java development. Providing unique priority based thread pools, and ways to distrbute threaded work safely.
Stars: ✭ 196 (-7.98%)
Mutual labels:  high-performance
High Performance Go
high performance coding with golang(Go 语言高性能编程,Go 语言陷阱,Gotchas,Traps)
Stars: ✭ 2,619 (+1129.58%)
Mutual labels:  high-performance
Proteus
Lean, mean, and incredibly fast JVM framework for web and microservice development.
Stars: ✭ 178 (-16.43%)
Mutual labels:  high-performance
Compute.scala
Scientific computing with N-dimensional arrays
Stars: ✭ 191 (-10.33%)
Mutual labels:  high-performance
Gol
gol is a high performance async log kit for golang
Stars: ✭ 166 (-22.07%)
Mutual labels:  high-performance
Ordinarydiffeq.jl
High performance differential equation solvers for ordinary differential equations, including neural ordinary differential equations (neural ODEs) and scientific machine learning (SciML)
Stars: ✭ 195 (-8.45%)
Mutual labels:  high-performance
Fastenum
The world fastest enum utilities for C#/.NET
Stars: ✭ 165 (-22.54%)
Mutual labels:  high-performance
Servicestack.redis
.NET's leading C# Redis Client
Stars: ✭ 2,236 (+949.77%)
Mutual labels:  high-performance
Tauri
Build smaller, faster, and more secure desktop applications with a web frontend.
Stars: ✭ 25,383 (+11816.9%)
Mutual labels:  high-performance
Webgl Plot
A high-Performance real-time 2D plotting library based on native WebGL
Stars: ✭ 200 (-6.1%)
Mutual labels:  high-performance
Stripe
Typed .NET clients for stripe.com REST APIs
Stars: ✭ 193 (-9.39%)
Mutual labels:  high-performance

A-J-Full-Screen-Image-Browser

Travis Code Swift npm

A-J-Full-Screen-Image-Browser is an drop-in solution for full screen image and video browser

Features

  • [x] No Dependency, 100% iOS Native
  • [x] Support both iPad and iPhone family
  • [x] Support image resizing on different screen orientation
  • [x] Support multiple videos and images
  • [x] Image can be panned, zoomed and rotated
  • [x] Double tap to zoom all the way in and again to zoom all the way out
  • [x] Swipe to dismiss
  • [x] High level diagram
  • [x] MVVM architecture
  • [x] Full documentation
  • [x] Easy to customise

Requirements

  • iOS 9.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 9.0+
  • Swift 4.0+

Installation

  • drag and drop the entire A_J_Full_Screen_Image_Browser into your project

Full Usage Example

import UIKit

final class ViewController: UIViewController {

    lazy var testVideo: MediaDownloadable = {
        return SingleMedia(imageURL: URL(string: "https://dummyimage.com/600&text=thumbnail")!,
                    isVideoThumbnail: true,
                    videoURL: URL(string: "http://jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v")!)
    }()

    lazy var media: [MediaDownloadable] = {
        return [testVideo,
                SingleMedia(imageURL: URL(string: "https://dummyimage.com/300")!),
                SingleMedia(imageURL: URL(string: "https://dummyimage.com/600")!),
                testVideo]
    }()

    @IBAction func onButtonTapped(_ sender: UIButton) {
        let vm = FullScreenImageBrowserViewModel(media: media)
        let browser = FullScreenImageBrowser(viewModel: vm)
        present(browser, animated: true, completion: nil)
    }

}

AlamofireImage Support

By default, FullScreenImageBrowser doesn't use any 3rd library, the SingleImage uses URLSession to fetch image. However it's designed to be compatible with any networking library, one good example is AlamofireImage

The following code snippet shows an example how to use AlamofireImage to seamlessly integrated with FullScreenImageBrowser.

import Foundation
import AlamofireImage

public class FullScreenImage: MediaDownloadable {
    public var image: UIImage?
    public var imageURL: URL?
    public var videoURL: URL?
    public var isVideoThumbnail: Bool

    public init(imageURL: URL?, isVideoThumbnail: Bool = false, videoURL: URL? = nil) {
        self.imageURL = imageURL
        self.videoURL = videoURL
        self.isVideoThumbnail = isVideoThumbnail
    }

    public func loadImageWithCompletionHandler(_ completion: @escaping (UIImage?, NSError?) -> Void) {
        if let image = image {
            completion(image, nil)
            return
        }
        loadImageWithURL(imageURL, completion: completion)
    }

    // use any network calls you like
    public func loadImageWithURL(_ url: URL?, completion: @escaping (_ image: UIImage?, _ error: NSError?) -> Void) {
        guard let _url = url else {
            completion(nil, NSError(domain: "FullScreenImageBrowserDomain",
                                    code: -2,
                                    userInfo: [ NSLocalizedDescriptionKey: "Image URL not found."]))
            return
        }
        let urlRequest = URLRequest(url: _url)

        downloader.download(urlRequest) { [weak self] response in
            debugPrint(response.result)

            if let remoteImage = response.result.value {
                self?.image = remoteImage
                completion(remoteImage, nil)
            } else {
                completion(nil, NSError(domain: "FullScreenImageBrowserDomain",
                                        code: -1,
                                        userInfo: [ NSLocalizedDescriptionKey: "Couldn't load image from remote"]))
            }
        }
    }
}

Folder Structure

├── animator
│   └── FullScreenImageTransitionAnimator.swift
├── asset
│   └── FullScreenImageBrowser.bundle
│       ├── close.png
│       ├── [email protected]
│       └── [email protected]
├── core
│   ├── FullScreenImageBrowser.swift
│   ├── FullScreenImageBrowserViewModel.swift
│   ├── MediaDownloadable.swift
│   ├── MaskImageViewer.swift
│   ├── SingleImageViewer.swift
│   └── ZoomableImageView.swift
└── helper
    ├── SingleImage.swift
    └── UIView+SnapShot.swift
File Responsiblity
animator customised fade in/fade out animations with damping factors
asset customised static image asset for the full screen image/video browser navigation bar
core/FullScreenImageBrowser manager class to be responsible for full screen image/video browser
core/FullScreenImageBrowserViewModel datasource and business logic for full screen image/video browser
core/MediaDownloadable protocol to define images to be able to asynchronously download
core/MaskImageViewer customised overlay view for full screen image/video browser
core/SingleImageViewer view controller to be responsible for single image rendering on the full screen
core/ZoomableImageView view to add support for image to zoom, pin, rotate, and animation

Demo

HLD

Credits

A-J-Full-Screen-Image-Browser is owned and maintained by the Alex Jiang. Thanks iTMan.design for providing computational resources.

License

A-J-Full-Screen-Image-Browser is released under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].