Skip to main content

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.

Swift Platform SPM

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 options
  • RProductImageView โ†’ Advanced image loading with placeholders and error states

Cart & Checkout Componentsโ€‹

  • CartManager โ†’ Global cart state management with reactive updates
  • RCheckoutOverlay โ†’ Complete checkout flow as modal overlay
  • RProductDetailOverlay โ†’ Full-screen product detail modal with gallery
  • RFloatingCartIndicator โ†’ Persistent cart indicator across all screens
  • RToastNotification โ†’ 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 sizes
  • ReachuColors โ†’ Unified color palette for brand consistency
  • ReachuTypography โ†’ Typography scale for proper text hierarchy
  • ReachuSpacing โ†’ 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)
}
}

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โ€‹

PlatformMinimum VersionNotes
iOS15.0+Full feature support
macOS12.0+Complete SwiftUI components
tvOS15.0+Optimized for TV interfaces
watchOS8.0+Essential components only

๐Ÿ“„ Licenseโ€‹

This project is licensed under the MIT License - see the LICENSE file for details.


Ready to build amazing iOS shopping experiences?