Swiftpack.co - jackpal/RemoteImage as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by jackpal.
jackpal/RemoteImage 0.0.2
A SwiftUI RemoteImage package. This one is especially good with large files.
⭐️ 2
🕓 4 years ago
iOS watchOS tvOS
.package(url: "https://github.com/jackpal/RemoteImage.git", from: "0.0.2")

RemoteImage

by Jack Palevich

Yet another remote image package for SwiftUI.

This one's better than most other RemoteImage implementations because:

  • It takes an optional maximum size parameter, and scales down large images to fit the given maximum size.
    • by default images will be clamped to be no larger than full screen size.
  • It pre-rasterizes the image off the main thread, which greatly reduces "jank" when the image is first show.

Example

import RemoteImage
import SwiftUI

struct ContentView: View {
  
    var body: some View {
      GeometryReader{proxy in
        RemoteImage(loader:ImageLoader(
          url:URL(string:"https://example.com/myimage.jpg")!,
          targetSize: proxy.size))
    }
  }
}

Credits

Thanks to all the RemoteImage tutorials on the web, especially:

And probably other tutorials that I've accidentally omitted.

Version History

0.0.2 - add a simple RAM cache.

0.0.1 - first version.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics