ShopSavvyUI

April 3, 2026 ยท View on GitHub

Swift Package Manager Platform Swift License: MIT

SwiftUI views and view models for the ShopSavvy Data API. Drop-in components for product cards, price comparison, and deal feeds.

Installation

Swift Package Manager

Xcode: File > Add Package Dependencies > https://github.com/shopsavvy/swiftui-shopsavvy.git

Package.swift:

dependencies: [
    .package(url: "https://github.com/shopsavvy/swiftui-shopsavvy.git", from: "1.0.0"),
]

Quick Start

import ShopSavvyUI

let client = ShopSavvyUIClient(apiKey: "ss_live_your_api_key_here")

struct ContentView: View {
    @State private var viewModel: ProductSearchViewModel

    init() {
        _viewModel = State(initialValue: ProductSearchViewModel(client: client))
    }

    var body: some View {
        List(viewModel.products, id: \.shopsavvy) { product in
            ProductCardView(product: product)
        }
        .task { await viewModel.search(query: "airpods pro") }
    }
}

Get your API key at shopsavvy.com/data.

Components

ShopSavvyUIClient

Thread-safe actor wrapping the ShopSavvy Swift SDK.

let client = ShopSavvyUIClient(apiKey: "ss_live_...")

let products = try await client.searchProducts(query: "iphone 15")
let offers = try await client.getCurrentOffers(identifier: "012345678901")
let history = try await client.getPriceHistory(identifier: "012345678901", days: 90)

ProductCardView

Displays product image, title, brand, and optional price.

ProductCardView(
    product: myProduct,
    bestPrice: 199.99,
    currency: "USD",
    onTap: { print("tapped") }
)

PriceComparisonView

Sorted list of retailer offers with availability indicators.

PriceComparisonView(
    offers: productWithOffers.offers,
    onOfferTap: { offer in openURL(offer.url) }
)

DealFeedView

Scrollable feed of current deals with grades, prices, and votes.

DealFeedView(client: client, sort: "hot", limit: 20) { deal in
    openURL(URL(string: deal.url)!)
}

View Models

All view models use @Observable and are designed for SwiftUI's observation system.

View ModelPurpose
ProductSearchViewModelProduct search with loading/error state
PriceComparisonViewModelOffer loading with best-offer computation
PriceHistoryViewModelHistorical price data loading

Requirements

  • iOS 17.0+ / macOS 14.0+ / tvOS 17.0+ / watchOS 10.0+
  • Swift 5.9+ / Xcode 15.0+

License

MIT