Reachu Swift SDK
A modular Swift SDK for iOS, macOS, tvOS, and watchOS to manage shopping carts, checkouts, discounts, markets, channels and payments using GraphQL. Built with modern SwiftUI components and designed for scalability and performance.
Why Choose Swift + SwiftUI?โ
- Native Performance: Compiled to native code for optimal performance on Apple platforms
- Modular Architecture: Import only the components you need for smaller app sizes
- Modern SwiftUI: Beautiful, declarative UI components with built-in accessibility
- Type Safety: Leverage Swift's strong type system for reliable ecommerce operations
- Cross-Platform: Support for iPhone, iPad, Mac, Apple TV, and Apple Watch
๐๏ธ Modular Architectureโ
The Swift SDK is designed with a modular approach that allows you to import only what you need:
Core Modulesโ
- ๐ง ReachuCore (Required) โ Essential ecommerce functionality, models, and business logic
- ๐ ReachuNetwork (Internal) โ Shared networking layer with Apollo GraphQL client
UI Modulesโ
- ๐จ ReachuUI (Optional) โ SwiftUI components for ecommerce interfaces
- ๐ญ ReachuDesignSystem (Internal) โ Design tokens, colors, typography, and base components
Live Shopping Modulesโ
- ๐ฅ ReachuLiveShow (Optional) โ Real-time livestream shopping features
- ๐บ ReachuLiveUI (Optional) โ SwiftUI components for livestream interfaces
Development Modulesโ
- ๐งช ReachuTesting (Internal) โ Mock data providers and testing utilities
๐ฆ Quick Installationโ
Add the Reachu Swift SDK to your project using Swift Package Manager:
Package.swift
dependencies: [
.package(url: "https://github.com/ReachuDevteam/ReachuSwiftSDK.git", from: "1.0.0")
]
Choose Your Modulesโ
Import only what you need to keep your app size minimal:
Package.swift
targets: [
.target(
name: "YourApp",
dependencies: [
// Core functionality only
.product(name: "ReachuCore", package: "ReachuSwiftSDK"),
// Core + UI Components
.product(name: "ReachuUI", package: "ReachuSwiftSDK"),
// Core + LiveShow
.product(name: "ReachuLiveShow", package: "ReachuSwiftSDK"),
// Everything included
.product(name: "ReachuComplete", package: "ReachuSwiftSDK"),
]
),
]
๐ Basic Usageโ
ContentView.swift
import SwiftUI
import ReachuCore
import ReachuUI
struct ContentView: View {
@StateObject private var cartManager = CartManager()
var body: some View {
NavigationView {
ScrollView {
// Display products with built-in UI components
LazyVGrid(columns: [
GridItem(.flexible()),
GridItem(.flexible())
]) {
ForEach(products) { product in
RProductCard(
product: product,
variant: .grid,
onAddToCart: {
cartManager.addToCart(product)
}
)
}
}
}
.navigationTitle("Products")
}
}
}
๐จ SwiftUI Componentsโ
The Swift SDK includes beautiful, ready-to-use SwiftUI components:
Product Componentsโ
RProductCard
โ Flexible product cards with 4 layout variants (grid, list, hero, minimal)RProductSlider
โ Horizontal scrolling product galleries with 6 layout optionsRProductImageView
โ Advanced image loading with placeholders and error states
Cart & Checkout Componentsโ
CartManager
โ Global cart state management with reactive updatesRCheckoutOverlay
โ Complete checkout flow as modal overlayRProductDetailOverlay
โ Full-screen product detail modal with galleryRFloatingCartIndicator
โ Persistent cart indicator across all screensRToastNotification
โ Elegant notification system with auto-dismiss
Enhanced UX Featuresโ
- Automatic Animations โ Button feedback, product highlighting, spring transitions
- Haptic Feedback โ Tactile confirmation on iOS devices (light, medium, heavy)
- Auto-Notifications โ Smart toasts for cart operations with product names
- Visual Feedback โ Loading states, success indicators, error handling
Design Systemโ
RButton
โ Consistent buttons with multiple styles and sizesReachuColors
โ Unified color palette for brand consistencyReachuTypography
โ Typography scale for proper text hierarchyReachuSpacing
โ Consistent spacing tokens for layouts
Documentation Structureโ
๐ก Module Examplesโ
Core Module Usageโ
CartManager.swift
import ReachuCore
class CartManager: ObservableObject {
private let sdk = ReachuSDK.shared
@Published var cart: Cart?
func createCart() async {
do {
self.cart = try await sdk.cart.create(
customerSessionId: "session-123",
currency: "USD"
)
} catch {
print("Failed to create cart: \(error)")
}
}
}
UI Components Usageโ
ProductView.swift
import SwiftUI
import ReachuUI
struct ProductView: View {
let product: Product
var body: some View {
VStack(spacing: ReachuSpacing.lg) {
// Different layout variants
RProductCard(product: product, variant: .hero, showDescription: true)
RProductCard(product: product, variant: .grid)
RProductCard(product: product, variant: .list)
RProductCard(product: product, variant: .minimal)
}
.padding(ReachuSpacing.lg)
}
}
Design System Usageโ
CustomView.swift
import SwiftUI
import ReachuDesignSystem
struct CustomView: View {
var body: some View {
VStack(spacing: ReachuSpacing.md) {
Text("Welcome to Reachu")
.font(ReachuTypography.largeTitle)
.foregroundColor(ReachuColors.primary)
RButton(
title: "Add to Cart",
style: .primary,
size: .large
) {
// Handle action
}
}
.padding(ReachuSpacing.lg)
.background(ReachuColors.surface)
.cornerRadius(ReachuBorderRadius.large)
}
}
๐ Recommended Setupโ
For production apps, initialize the SDK in your App delegate or main App struct:
App.swift
import SwiftUI
import ReachuCore
@main
struct MyApp: App {
init() {
ReachuSDK.configure(
baseURL: "https://graph-ql-dev.reachu.io",
apiKey: "your-api-key"
)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
๐ฏ Platform Supportโ
Platform | Minimum Version | Notes |
---|---|---|
iOS | 15.0+ | Full feature support |
macOS | 12.0+ | Complete SwiftUI components |
tvOS | 15.0+ | Optimized for TV interfaces |
watchOS | 8.0+ | Essential components only |
๐ Useful Linksโ
- GitHub Repository - Source code and issues
- Getting Started Guide - Step-by-step setup
- UI Components - SwiftUI component library
- API Reference - Complete method documentation
- Support - Technical support
๐ Licenseโ
This project is licensed under the MIT License - see the LICENSE file for details.
Ready to build amazing iOS shopping experiences?