Everything you need to integrate the Yaystack SDK into your iOS or Android app. Requirements, installation, initialization, views, theming, and API reference.
Requirements
| Platform | iOS 16.0+ |
| Language | Swift 5.9+ |
| IDE | Xcode 15+ |
| Dependencies | None (uses URLSession, MapKit, CoreLocation) |
Installation
Add via Swift Package Manager
In Xcode, go to File > Add Package Dependencies and enter:
https://github.com/yaystack/yaystack-ios
Or add it directly in your Package.swift:
swiftdependencies: [
.package(url: "https://github.com/yaystack/yaystack-ios.git", from: "1.0.0")
]Configure Info.plist
Add the following keys to your Info.plist:
| Key | Required | Description |
|---|---|---|
NSLocationWhenInUseUsageDescription | Required | Location services for nearby giveaways |
NSCameraUsageDescription | Optional | Only if using react-to-claim feature |
NSMicrophoneUsageDescription | Optional | Only if using react-to-claim feature |
Initialize the SDK
Initialize Yaystack in your app entry point with your API key (found in SDK Settings):
swiftimport YaystackSDK
@main
struct MyApp: App {
init() {
Yaystack.initialize(token: "biz_your_api_key_here")
}
}With optional theme and account linking:
swiftvar theme = YaystackTheme()
theme.accentColor = .orange
Yaystack.initialize(
token: "biz_...",
accountLinkingEnabled: true,
theme: theme
)Set the user
After your user authenticates, pass their unique ID to the SDK. Call clearUser() on sign out.
swift// After login
Yaystack.setUser(id: "user_123")
// On logout
Yaystack.clearUser()Add SDK views
Drop these views into your app wherever you want the Yaystack experience:
| View | Description |
|---|---|
YaystackMapView() | Interactive map with giveaway pins, coin drops, and the full claim flow. Supports |
YaystackClaimsListView() | Paginated claim history with coin balance display. |
YaystackMapAdapter() | Attach to your existing MKMapView (UIKit / SwiftUI compatible). |
swiftimport YaystackSDK
struct RewardsView: View {
var body: some View {
YaystackMapView()
}
}Customize the callout style to control how giveaway details are displayed when a pin is tapped:
swift// Inline card at the bottom of the map (default)
YaystackMapView(calloutStyle: .inline)
// Draggable bottom sheet
YaystackMapView(calloutStyle: .sheet)
// Hide the claims list button
YaystackMapView(showClaimsButton: false)Theme Customization
| Property | Type | Description |
|---|---|---|
accentColor | Color | Interactive elements, highlights |
claimButtonColor | Color | Claim button background |
claimButtonTextColor | Color | Claim button text |
secondaryTextColor | Color | Descriptions, captions |
errorColor | Color | Error messages |
successColor | Color | Success states |
cardBackgroundColor | Color | Card / pill background |
usesMaterialBackground | Bool | iOS blur material vs solid background |
headlineFont | Font | Giveaway name, section titles (34pt bold) |
bodyFont | Font | Descriptions, account name (20pt) |
captionFont | Font | Labels, small text (12pt) |
buttonFont | Font | Button text (20pt semibold) |
mapType | .standard / .satellite / .hybrid | Map rendering style |
initialAltitude | Double | Camera altitude in meters (default: 500) |
initialPitch | Double | Camera tilt 0-65 degrees (default: 65) |
cornerRadius | CGFloat | Card corner radius (default: 20) |
buttonCornerRadius | CGFloat | Button corner radius (default: 12) |
API Reference
| Method / Property | Description |
|---|---|
Yaystack.initialize(token:accountLinkingEnabled:theme:) | Initialize with API key and optional config |
Yaystack.setUser(id:) | Set the current user after authentication |
Yaystack.clearUser() | Clear user on sign out |
Yaystack.updateTheme(_:) | Update theme at runtime |
Yaystack.isConfigured | Bool -- whether SDK is initialized |
Yaystack.shared.coinBalance | Current user's coin balance |
Yaystack.shared.coinName | Custom coin name |
Yaystack.shared.yaycoinEnabled | Whether YayCoin is enabled |
Yaystack.shared.linkedAccount | Linked Yaystack account (if any) |