All Projects → KittenYang → Longinus

KittenYang / Longinus

Licence: mit
A pure Swift high-performance asynchronous image loading framework. SwiftUI supported.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Longinus

A j full screen image browser
High Performance Full Screen Image and Video browser in iOS
Stars: ✭ 213 (-14.8%)
Mutual labels:  high-performance
Fast Sass Loader
High performance sass loader for webpack
Stars: ✭ 229 (-8.4%)
Mutual labels:  high-performance
Libheatmap
High performance C heatmap generation library. Supposed to be wrapped by higher-level languages.
Stars: ✭ 241 (-3.6%)
Mutual labels:  high-performance
Flexml
🚀基于Litho的Android高性能动态业务容器。
Stars: ✭ 225 (-10%)
Mutual labels:  high-performance
Varnish Cache
Varnish Cache source code repository
Stars: ✭ 2,769 (+1007.6%)
Mutual labels:  high-performance
Tf Quant Finance
High-performance TensorFlow library for quantitative finance.
Stars: ✭ 2,925 (+1070%)
Mutual labels:  high-performance
Tauri
Build smaller, faster, and more secure desktop applications with a web frontend.
Stars: ✭ 25,383 (+10053.2%)
Mutual labels:  high-performance
Libaco
A blazing fast and lightweight C asymmetric coroutine library 💎 ⛅🚀⛅🌞
Stars: ✭ 2,918 (+1067.2%)
Mutual labels:  high-performance
Tablesaw
Java dataframe and visualization library
Stars: ✭ 2,785 (+1014%)
Mutual labels:  high-performance
Evpp
A modern C++ network library for developing high performance network services in TCP/UDP/HTTP protocols.
Stars: ✭ 2,850 (+1040%)
Mutual labels:  high-performance
Transducers.jl
Efficient transducers for Julia
Stars: ✭ 226 (-9.6%)
Mutual labels:  high-performance
Trinity
Trinity IR Infrastructure
Stars: ✭ 227 (-9.2%)
Mutual labels:  high-performance
Smoothscrollanimations
Demo of a tutorial on how to add smooth page scrolling with an inner image animation
Stars: ✭ 238 (-4.8%)
Mutual labels:  smooth-scrolling
Fpnn
Fast Programmable Nexus Network
Stars: ✭ 220 (-12%)
Mutual labels:  high-performance
Anevicon
🔥 A high-performant UDP load generator, written in Rust
Stars: ✭ 243 (-2.8%)
Mutual labels:  high-performance
Smooth Scrollbar
Customizable, Pluginable, and High-Performance JavaScript-Based Scrollbar Solution.
Stars: ✭ 2,695 (+978%)
Mutual labels:  smooth-scrolling
Golog
A high-performant Logging Foundation for Go Applications. X3 faster than the rest leveled loggers.
Stars: ✭ 208 (-16.8%)
Mutual labels:  high-performance
Clevergo
👅 CleverGo is a lightweight, feature rich and high performance HTTP router for Go.
Stars: ✭ 246 (-1.6%)
Mutual labels:  high-performance
Real Time Cpp
Real-Time C++ Companion Code
Stars: ✭ 242 (-3.2%)
Mutual labels:  high-performance
Nonblocking
Implementation of a lock-free dictionary on .Net.
Stars: ✭ 237 (-5.2%)
Mutual labels:  high-performance

Longinus



Longinus

Longinus is a pure-Swift high-performance asynchronous web image loading,caching,editing framework.

It was learned from Objective-C web image loading framework YYWebImage and BBWebImage, bring lots of high performace features to Swift. It may become a better choice for you.

Longinus's goal is to become the Highest-Performance web image loading framework on Swift.

Feature

  • Asynchronous image downloading and caching.
  • Preload images and cache them to disk for further showing.
  • Animated GIF support (dynamic buffer, lower memory usage).
  • Baseline/progressive/interlaced image decode support.
  • View extensions for UIImageView, UIButton, MKAnnotationView(not yet) and CALayer to directly set an image from a URL.
  • Built-in transition animation when setting images.(or you can set your custom image showing transion)
  • Image Transform after downloading supported: blur, round corner, resize, color tint, crop, rotate and more.
  • High performance memory and disk image cache. Use LRU algorithm to manage. For disk cache, it use file system and sqlite for better performance.
  • Use FIFO queue to handle image downloading operation.
  • Smooth sliding without UI lags. High performance image caching and decoding to avoid main thread blocked.
  • SwiftUI support.

Usage

The simplest use-case is setting an image to an image view with the UIImageView extension:

let url = URL(string: "http://github.com/logo.png")
imageView.lg.setImage(with: url)

Load animated gif image:

let url = URL(string: "https://ww4.sinaimg.cn/bmiddle/eaeb7349jw1ewbhiu69i2g20b4069e86.gif")
imageView.lg.setImage(with: url)

Load image progressively:

let url = URL(string: "http://github.com/logo.png")
imageView.lg.setImage(with: url, options: [.progressiveBlur, .imageWithFadeAnimation])

Load and transform image:

let url = URL(string: "https://ww4.sinaimg.cn/bmiddle/eaeb7349jw1ewbhiu69i2g20b4069e86.gif")
let transformer = ImageTransformer.imageTransformerCommon(with: imageView.frame.size, borderWidth: 2.0, borderColor: .white)
imageView.lg.setImage(with: url, options: [.progressiveBlur, .imageWithFadeAnimation], transformer: transformer)

Usage in SwiftUI:

import SwiftUI

// 1. If you are using SPM or Carthage, the SwiftUI support is defined in a new module.
import LonginusSwiftUI

// 2. If you are using CocoaPods, in which the SwiftUI support is defined in the Longinus module.
//    Here we choose to just import the `LGImage` type instead of the whole module, 
//    to prevent the conflicting between `Longinus.View` and `SwiftUI.View`
import struct Longinus.LGImage

var body: some View {
    LGImage(source: URL(string: "https://github.com/KittenYang/Template-Image-Set/blob/master/Landscape/landscape-\(index).jpg?raw=true"), placeholder: {
            Image(systemName: "arrow.2.circlepath")
                .font(.largeTitle) })
        .onProgress(progress: { (data, expectedSize, _) in
            print("Downloaded: \(data?.count ?? 0)/\(expectedSize)")
        })
        .onCompletion(completion: { (image, data, error, cacheType) in
            if let error = error {
                print(error)
            }
            if let _ = image {
                print("Success!")
            }
        })
        .resizable()
        .cancelOnDisappear(true)
        .aspectRatio(contentMode: .fill)
        .frame(width: 300, height: 300)
        .cornerRadius(20)
        .shadow(radius: 5)
}

Requirements

  • iOS 10.0+
  • Swift 5.0+
  • SwiftUI 13.0+

Installation

CocoaPods

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

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target 'MyApp' do
  # your other pod
  # ...
  pod 'Longinus'
  # SwiftUI support is provided in a sub-spec. 
  # So instead of specifying pod 'Longinus', 
  # you need:
  # pod 'Longinus/SwiftUI'
end

Then, run the following command:

$ pod install

You should open the {Project}.xcworkspace instead of the {Project}.xcodeproj after you installed anything from CocoaPods.

For more information about how to use CocoaPods, I suggest this tutorial.

Carthage

Carthage is a decentralized dependency manager for Cocoa application. To install the carthage tool, you can use Homebrew.

To integrate Longinus into your Xcode project using Carthage, specify it in your Cartfile:

github "KittenYang/Longinus" ~> 1.0

Then, run the following command to build the Longinus framework:

$ carthage update

Swift Package Manager

From Xcode 11, you can use Swift Package Manager to add Longinus to your project.

Select File > Swift Packages > Add Package Dependency. Enter https://github.com/KittenYang/Longinus.git in the "Choose Package Repository" dialog.

Benchmark

I tested some popular web image loading frameworks on iOS platform from some aspects.

  • Image loading speed.
  • Memory&Disk read/write/delete speed.
  • Scrolling 4000 images UI fps.

Here is the tested results. (Lower is better)

Note: The test device is iPhone 11, running on iOS 13.3

You can git clone this repo and run the Benchmark.xcworkspace to test it by yourself.

License

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

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].