All Projects → kaishin → Imagescout

kaishin / Imagescout

Licence: mit
A Swift implementation of fastimage. Supports PNG, GIF, and JPEG.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Imagescout

Dikit
Dependency Injection Framework for Swift, inspired by KOIN.
Stars: ✭ 77 (-91.81%)
Mutual labels:  cocoapods, carthage, swiftpm
Swipycell
Easy to use UITableViewCell implementing swiping to trigger actions.
Stars: ✭ 230 (-75.53%)
Mutual labels:  cocoapods, carthage, swiftpm
Xcglogger
A debug log framework for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog() or print(), but with additional information, such as the date, function name, filename and line number.
Stars: ✭ 3,710 (+294.68%)
Mutual labels:  cocoapods, carthage, swiftpm
Blockhook
Hook Objective-C blocks. A powerful AOP tool.
Stars: ✭ 742 (-21.06%)
Mutual labels:  cocoapods, carthage
Gradients
🌔 A curated collection of splendid 180+ gradients made in swift
Stars: ✭ 719 (-23.51%)
Mutual labels:  cocoapods, carthage
Zephyr
Effortlessly synchronize UserDefaults over iCloud.
Stars: ✭ 722 (-23.19%)
Mutual labels:  cocoapods, carthage
Bluecap
iOS Bluetooth LE framework
Stars: ✭ 669 (-28.83%)
Mutual labels:  cocoapods, carthage
Statusalert
Display Apple system-like self-hiding status alerts. It is well suited for notifying user without interrupting user flow in iOS-like way.
Stars: ✭ 809 (-13.94%)
Mutual labels:  cocoapods, carthage
Nightnight
Elegant way to integrate night mode to swift projects
Stars: ✭ 771 (-17.98%)
Mutual labels:  cocoapods, carthage
Cascadingtabledelegate
A no-nonsense way to write cleaner UITableViewDelegate and UITableViewDataSource in Swift.
Stars: ✭ 931 (-0.96%)
Mutual labels:  cocoapods, carthage
Swipemenuviewcontroller
Swipable tab and menu View and ViewController.
Stars: ✭ 926 (-1.49%)
Mutual labels:  cocoapods, carthage
Koyomi
Simple customizable calendar component in Swift 📆
Stars: ✭ 716 (-23.83%)
Mutual labels:  cocoapods, carthage
Shiny
Iridescent Effect View (inspired by Apple Pay Cash) ✨
Stars: ✭ 707 (-24.79%)
Mutual labels:  cocoapods, carthage
Defaults
Swifty and modern UserDefaults
Stars: ✭ 734 (-21.91%)
Mutual labels:  cocoapods, carthage
Validatedpropertykit
Easily validate your Properties with Property Wrappers 👮
Stars: ✭ 701 (-25.43%)
Mutual labels:  cocoapods, carthage
Xlpagertabstrip
Android PagerTabStrip for iOS.
Stars: ✭ 6,671 (+609.68%)
Mutual labels:  cocoapods, carthage
Dockprogress
Show progress in your app's Dock icon
Stars: ✭ 813 (-13.51%)
Mutual labels:  cocoapods, carthage
Sdwebimageflplugin
A SDWebImage plugin to support GIF using FLAnimatedImage and category
Stars: ✭ 16 (-98.3%)
Mutual labels:  cocoapods, carthage
Imgix Swift
A Swift client library for generating URLs with imgix
Stars: ✭ 19 (-97.98%)
Mutual labels:  cocoapods, carthage
Interactivesidemenu
iOS Interactive Side Menu written in Swift.
Stars: ✭ 668 (-28.94%)
Mutual labels:  cocoapods, carthage
Logo

ImageScout

Test GitHub release Swift 5.0 platforms

ImageScout is a Swift implementation of fastimage. It allows you to find the size and type of a remote image by downloading as little as possible.

Why?

Sometimes you need to know the size of a remote image before downloading it, such as using a custom layout in a UICollectionView.

How?

ImageScout parses the image data as it is downloaded. As soon as it finds out the size and type of image, it stops the download. The downloaded data is below 60 KB in most cases.

Install

Swift Package Manager

Add the following to your Package.switft file:

let package = Package(
    dependencies: [
    .package(url: "https://github.com/kaishin/ImageScout.git", from: "2.1.0")
    ],
)

Carthage

  • Add the following to your Cartfile: github "kaishin/ImageScout"
  • Then run carthage update
  • Follow the current instructions in Carthage's README for up to date installation instructions.

CocoaPods

  • Add the following to your Podfile: pod 'ImageScout'
  • You will also need to make sure you're opting into using frameworks: use_frameworks!
  • Then run pod install with CocoaPods 1.0 or newer.

Usage

The only method you will be using is scoutImageWithURI(), with the following full signature:

func scoutImageWithURI(URI: String, completion: (NSError?, CGSize, ScoutedImageType) -> ())

Here's an example:

let scout = ImageScout()

scout.scoutImageWithURI("http://.../image-scout-logo.png") { error, size, type in
  if let error = error {
    print(error.code)
  } else {
    print("Size: \(size)")
    print("Type: \(type.rawValue)")
  }
}

If the image is not successfully parsed, the size is going to be CGSizeZero and the type .Unsupported. The error will contain more info about the reason:

  • Error code 100: Invalid URI parameter.
  • Error code 101: Image is corrupt or malformatted.
  • Error code 102: Not an image or unsopported image format URL.

⚠️ It's important to keep a strong reference to the ImageScout instance until the callback completes. If reference is lost, your completion handler will never be executed.

Compatibility

  • Swift 5 / Xcode 11
  • iOS 8+
  • macOS 10.11

License

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