stack/sdks/implementations/swift/Examples/StackAuthiOS
Bilal Godil d4f6f58735 feat(hexclave): PR 2 — visible rebrand to Hexclave
Rebased onto dev after PR 1475 (cl/hexclave-pr1) was squash-merged.
Squashes the original 46-commit branch (including PR1-duplicate commits
that arrived via cherry-picks/merges) into a single commit containing
only PR2's net delta over dev.

Original PR 1481 head: 94872de407873a1cabd4085deb21b69afe8d7699
(kept locally at backup/cl-romantic-mendel-5a2c25-pre-rebase)
2026-05-23 17:35:08 -07:00
..
.swiftpm/xcode/package.xcworkspace [Fix] [Feat] Update OAuth Sign-In and Get Token Functions to Work (#1130) 2026-01-28 02:17:27 +00:00
StackAuthiOS [Fix] [Feat] Update OAuth Sign-In and Get Token Functions to Work (#1130) 2026-01-28 02:17:27 +00:00
StackAuthiOS.xcodeproj [Fix] [Feat] Update OAuth Sign-In and Get Token Functions to Work (#1130) 2026-01-28 02:17:27 +00:00
README.md feat(hexclave): PR 2 — visible rebrand to Hexclave 2026-05-23 17:35:08 -07:00

Hexclave iOS Example

An interactive iOS application for testing all Hexclave Swift SDK functions.

Prerequisites

  • Xcode 15.0 or later
  • iOS 17.0+ Simulator or device
  • Running Hexclave backend (default: http://localhost:8102)

Running the Example

Option 1: Xcode

  1. Open the project in Xcode:

    open StackAuthiOS.xcodeproj
    
  2. Select an iOS Simulator (e.g., "iPhone 15 Pro" or any available device) as the destination

  3. Press ⌘R to build and run

Option 2: Command Line

# Build (replace device name with an available simulator on your system)
xcodebuild -scheme StackAuthiOS -destination 'platform=iOS Simulator,name=iPhone 15 Pro' build

# Build and run (opens simulator)
xcodebuild -scheme StackAuthiOS -destination 'platform=iOS Simulator,name=iPhone 15 Pro' run

Features

The app uses a tab-based interface optimized for mobile:

  • Settings: Configure API endpoint, project ID, and keys
  • Auth: Sign up, sign in, sign out, get current user
  • User: Update display name, metadata, view tokens
  • Teams: Create, list, and manage teams
  • Logs: View all SDK calls with full details (tap for more, long-press to copy)

Additional functions are accessible via navigation links in Settings:

  • Contact Channels
  • OAuth URL generation
  • Token operations
  • Server Users (admin)
  • Server Teams (admin)
  • Sessions (impersonation)

SDK Functions Covered

Client App

  • signUpWithCredential(email:password:)
  • signInWithCredential(email:password:)
  • signOut()
  • getUser() / getUser(or:)
  • getAccessToken() / getRefreshToken()
  • getAuthHeaders()
  • getOAuthUrl(provider:)

Current User

  • setDisplayName(_:)
  • update(clientMetadata:)
  • listTeams() / getTeam(id:)
  • createTeam(displayName:)
  • listContactChannels()

Server App

  • createUser(email:password:...)
  • listUsers(limit:)
  • getUser(id:)
  • createTeam(displayName:)
  • listTeams()
  • createSession(userId:)

Logging

The Logs tab shows all SDK activity in real-time:

  • Green checkmark: Successful calls with full response data
  • Red X: Errors with details
  • Blue info: In-progress calls

Tap any log entry to see full details. Long-press to copy to clipboard.

Network Configuration

For iOS Simulator to connect to your local backend:

  1. The default localhost:8102 should work in the simulator
  2. For a real device, use your computer's local IP address instead

Troubleshooting

"Could not connect to server"

  • Ensure your Hexclave backend is running
  • Check the Base URL in Settings tab
  • For real devices, use your computer's IP instead of localhost

Build errors

  • Make sure you have Xcode 15+ installed
  • Try cleaning: Product → Clean Build Folder (⇧⌘K)