Swiftpack.co - yutailang0119/SBPAsyncImage as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
yutailang0119/SBPAsyncImage
Backport of SwiftUI.AsyncImage to iOS 14, macOS 11, tvOS 14 and watchOS 7 and earlier.
.package(url: "https://github.com/yutailang0119/SBPAsyncImage.git", from: "0.2.0")

SBPAsyncImage

Swift 5.4 SwiftUI Swift Package Manager Lincense

Backport of SwiftUI.AsyncImage to iOS 14, macOS 11, tvOS 14 and watchOS 7 and earlier.

AsyncImage is a view that asynchronously loads and displays an image.
However, AsyncImage is available from iOS 15, macOS 12, tvOS 15, and watchOS 8.
SBPAsyncImage provides interface and behavior of AsyncImage to earlier OS.

A Work In Progress

SBPAsyncImage is still in active development.
Please file all bugs, issues, and suggestions as an Issue in the GitHub repository.

Installation

Swift Package Manager

// swift-tools-version:5.4
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "SBPAsyncImageExample",
    platforms: [
        .iOS(.v13),
        .macOS(.v10_15),
        .tvOS(.v13),
        .watchOS(.v6),
    ],
    dependencies: [
        .package(url: "https://github.com/yutailang0119/SBPAsyncImage", .exact("0.1.0")),
    ],
    targets: [
        .target(
            name: "SBPAsyncImageExample",
            dependencies: ["SBPAsyncImage"]),
    ]
)

Usage

import SwiftUI
import SBPAsyncImage

struct ContentView: View {
    var body: some View {
        BackportAsyncImage(url: URL(string: "https://example.com/icon.png"))
            .frame(width: 200, height: 200)
    }
}

Custom placeholder

import SwiftUI
import SBPAsyncImage

struct ContentView: View {
    var body: some View {
        BackportAsyncImage(url: URL(string: "https://example.com/icon.png")) { image in
            image.resizable()
        } placeholder: {
            ProgressView()
        }
        .frame(width: 50, height: 50)
    }
}

Author

Yutaro Muta

License

The project is available under MIT Licence

GitHub

link
Stars: 20
Last commit: 4 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

0.2.0
1 week ago

Compatibility

  • Following Xcode Version 13.0 (13A233)
  • ⚠️ Not support scale on macOS

What's Changed

Full Changelog: https://github.com/yutailang0119/SBPAsyncImage/compare/0.1.2...0.2.0

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