{"id":13778250,"url":"https://github.com/KittenYang/Longinus","last_synced_at":"2025-05-11T11:35:14.909Z","repository":{"id":42049190,"uuid":"262936444","full_name":"KittenYang/Longinus","owner":"KittenYang","description":"A pure Swift high-performance asynchronous image loading framework. SwiftUI supported.","archived":false,"fork":false,"pushed_at":"2022-12-03T10:37:13.000Z","size":1626,"stargazers_count":330,"open_issues_count":4,"forks_count":15,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-07T04:03:12.247Z","etag":null,"topics":["high-performance","image-loading-library","ios","ios-swift","smooth-scrolling","swift","swiftui","swiftui-framework","swiftui-image","webimage","yywebimage"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KittenYang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-11T04:16:49.000Z","updated_at":"2025-04-30T02:22:12.000Z","dependencies_parsed_at":"2022-08-12T03:20:58.933Z","dependency_job_id":null,"html_url":"https://github.com/KittenYang/Longinus","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KittenYang%2FLonginus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KittenYang%2FLonginus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KittenYang%2FLonginus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KittenYang%2FLonginus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KittenYang","download_url":"https://codeload.github.com/KittenYang/Longinus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253560026,"owners_count":21927719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["high-performance","image-loading-library","ios","ios-swift","smooth-scrolling","swift","swiftui","swiftui-framework","swiftui-image","webimage","yywebimage"],"created_at":"2024-08-03T18:00:52.395Z","updated_at":"2025-05-11T11:35:14.408Z","avatar_url":"https://github.com/KittenYang.png","language":"Swift","funding_links":[],"categories":["Image"],"sub_categories":["Content"],"readme":"\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/KittenYang/Longinus\"\u003e\n\u003cimg src=\"Assets/Logo.png\" alt=\"Longinus\" /\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/KittenYang/Longinus/actions?query=workflow%3Abuild\"\u003e\u003cimg src=\"https://img.shields.io/github/workflow/status/KittenYang/Longinus/build/master?style=for-the-badge\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/KittenYang/Longinus/graphs/contributors\"\u003e\u003cimg src=\"https://img.shields.io/github/contributors/KittenYang/Longinus.svg?style=for-the-badge\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/KittenYang/Longinus/network/members\"\u003e\u003cimg src=\"https://img.shields.io/github/forks/KittenYang/Longinus.svg?style=for-the-badge\"\u003e\u003c/a\u003e  \n  \u003ca href=\"https://github.com/KittenYang/Longinus/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/KittenYang/Longinus.svg?style=for-the-badge\"\u003e\u003c/a\u003e  \n  \u003cbr /\u003e\n  \u003ca href=\"https://cocoapods.org/pods/Longinus\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/v/Longinus.svg?style=for-the-badge\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/Carthage/Carthage/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Carthage-compatible-ff69b4?style=for-the-badge\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://swift.org/package-manager/\"\u003e\u003cimg src=\"https://img.shields.io/badge/SPM-compatible-orange?style=for-the-badge\"\u003e\u003c/a\u003e \n  \u003cbr /\u003e\n  \u003ca href=\"https://cocoapods.org/pods/Longinus\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/l/Longinus.svg?style=for-the-badge\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://cocoapods.org/pods/Longinus\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/p/Longinus.svg?style=for-the-badge\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n# Longinus\nLonginus is a pure-Swift high-performance asynchronous web image loading,caching,editing framework.\n\nIt was learned from Objective-C web image loading framework [YYWebImage](https://github.com/ibireme/YYWebImage) and [BBWebImage](https://github.com/Silence-GitHub/BBWebImage), bring lots of high performace features to Swift. It may become a better choice for you.\n\nLonginus's goal is to become the Highest-Performance web image loading framework on Swift.\n\n## Feature\n* Asynchronous image downloading and caching.\n* Preload images and cache them to disk for further showing.\n* Animated GIF support (dynamic buffer, lower memory usage).\n* Baseline/progressive/interlaced image decode support.\n* View extensions for UIImageView, UIButton, MKAnnotationView(not yet) and CALayer to directly set an image from a URL.\n* Built-in transition animation when setting images.(or you can set your custom image showing transion)\n* Image Transform after downloading supported: blur, round corner, resize, color tint, crop, rotate and more.\n* High performance memory and disk image cache. Use LRU algorithm to manage. For disk cache, it use file system and sqlite for better performance.\n* Use FIFO queue to handle image downloading operation.\n* Smooth sliding without UI lags. High performance image caching and decoding to avoid main thread blocked.\n* SwiftUI support.\n\n## Usage\n\nThe simplest use-case is setting an image to an image view with the UIImageView extension:\n```swift\nlet url = URL(string: \"http://github.com/logo.png\")\nimageView.lg.setImage(with: url)\n```\nLoad animated gif image:\n```swift\nlet url = URL(string: \"https://ww4.sinaimg.cn/bmiddle/eaeb7349jw1ewbhiu69i2g20b4069e86.gif\")\nimageView.lg.setImage(with: url)\n```\nLoad image progressively:\n```swift\nlet url = URL(string: \"http://github.com/logo.png\")\nimageView.lg.setImage(with: url, options: [.progressiveBlur, .imageWithFadeAnimation])\n```\nLoad and transform image:\n```swift\nlet url = URL(string: \"https://ww4.sinaimg.cn/bmiddle/eaeb7349jw1ewbhiu69i2g20b4069e86.gif\")\nlet transformer = ImageTransformer.imageTransformerCommon(with: imageView.frame.size, borderWidth: 2.0, borderColor: .white)\nimageView.lg.setImage(with: url, options: [.progressiveBlur, .imageWithFadeAnimation], transformer: transformer)\n```\nUsage in SwiftUI:\n```swift\nimport SwiftUI\n\n// 1. If you are using SPM or Carthage, the SwiftUI support is defined in a new module.\nimport LonginusSwiftUI\n\n// 2. If you are using CocoaPods, in which the SwiftUI support is defined in the Longinus module.\n//    Here we choose to just import the `LGImage` type instead of the whole module, \n//    to prevent the conflicting between `Longinus.View` and `SwiftUI.View`\nimport struct LonginusSwiftUI.LGImage\n\nvar body: some View {\n    LGImage(source: URL(string: \"https://github.com/KittenYang/Template-Image-Set/blob/master/Landscape/landscape-\\(index).jpg?raw=true\"), placeholder: {\n            Image(systemName: \"arrow.2.circlepath\")\n                .font(.largeTitle) })\n        .onProgress(progress: { (data, expectedSize, _) in\n            print(\"Downloaded: \\(data?.count ?? 0)/\\(expectedSize)\")\n        })\n        .onCompletion(completion: { (image, data, error, cacheType) in\n            if let error = error {\n                print(error)\n            }\n            if let _ = image {\n                print(\"Success！\")\n            }\n        })\n        .resizable()\n        .cancelOnDisappear(true)\n        .aspectRatio(contentMode: .fill)\n        .frame(width: 300, height: 300)\n        .cornerRadius(20)\n        .shadow(radius: 5)\n}\n\n```\n\n# Requirements\n* iOS 10.0+\n* Swift 5.0+\n* SwiftUI 13.0+\n\n# Installation\n## CocoaPods\n\nLonginus is available through [CocoaPods](https://cocoapods.org). To install it, simply add the following line to your Podfile:\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '10.0'\nuse_frameworks!\n\ntarget 'MyApp' do\n  # your other pod\n  # ...\n  pod 'Longinus'\n  # SwiftUI support is provided in a sub-spec. \n  # So instead of specifying pod 'Longinus', \n  # you need:\n  # pod 'Longinus/SwiftUI'\nend\n```\n\nThen, run the following command:\n\n```\n$ pod install\n```\n\nYou should open the {Project}.xcworkspace instead of the {Project}.xcodeproj after you installed anything from CocoaPods.\n\nFor more information about how to use CocoaPods, I suggest this [tutorial](http://www.raywenderlich.com/64546/introduction-to-cocoapods-2).\n\n## Carthage\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager for Cocoa application. To install the carthage tool, you can use [Homebrew](http://brew.sh/).\n\nTo integrate Longinus into your Xcode project using Carthage, specify it in your Cartfile:\n\n```\ngithub \"KittenYang/Longinus\" ~\u003e 1.0\n```\nThen, run the following command to build the Longinus framework:\n\n```\n$ carthage update\n```\n\n## Swift Package Manager\nFrom Xcode 11, you can use [Swift Package Manager](https://swift.org/package-manager/) to add Longinus to your project.\n\nSelect File \u003e Swift Packages \u003e Add Package Dependency. Enter `https://github.com/KittenYang/Longinus.git` in the \"Choose Package Repository\" dialog.\n\n# Benchmark\nI tested some popular web image loading frameworks on iOS platform from some aspects.\n* Image loading speed. \n* Memory\u0026Disk read/write/delete speed.\n* Scrolling 4000 images UI fps.\n\nHere is the tested results. *(Lower is better)*\n\n*Note: The test device is iPhone 11, running on iOS 13.3*\n\n![](Assets/Image_loading_speed_benchmark.jpeg)\n\n![](Assets/Memory_IO_benchmark.jpeg)\n\n![](Assets/Disk_IO_benchmark.jpeg)\n\n\nYou can git clone this repo and run the `Benchmark.xcworkspace` to test it by yourself.\n\n## License\n\nLonginus is available under the MIT license. See the LICENSE file for more info.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKittenYang%2FLonginus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKittenYang%2FLonginus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKittenYang%2FLonginus/lists"}