Swiftpack.co - HumorousGhost/Slideshow as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by HumorousGhost.
HumorousGhost/Slideshow v1.0.1
an automatic scrolling carousel similar to how scrollview is used. for swiftui
⭐️ 1
🕓 1 week ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/HumorousGhost/Slideshow.git", from: "v1.0.1")

Slideshow

This project is only for SwiftUI

An automatic scrolling carousel similar to how ScrollView is used

Preview

image

Supported Platforms

  • iOS 13.0
  • macOS 10.15
  • tvOS 13.0
  • watchOS 6.0

Usage

    struct Item: Identifiable {
        let id = UUID()
        let image: String
        let title: String
    }
    
    let items = [
        Item(image: "image1", title: "first"),
        Item(image: "image2", title: "second"),
        Item(image: "image3", title: "third"),
        Item(image: "image4", title: "fourth")
    ]
    
    var body: some View {
        VStack {
            Spacer()
            Slideshow(items, spacing: 20, isWrap: true, autoScroll: .active(2)) { item in
                itemView(item: item)
                    .frame(width: 350, height: 200)
                    .cornerRadius(16)
            }
            .frame(width: UIScreen.main.bounds.width, height: 200)
            Spacer()
        }
    }
    
    @ViewBuilder
    func itemView(item: Item) -> some View {
        ZStack {
            Image(item.image)
                .resizable()
                .aspectRatio(contentMode: .fill)
                .frame(height: 200)
        }
    }

Installation

You can add Slideshow to an Xcode project by adding it as a package dependency

GitHub

link
Stars: 1
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

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