iOS SDK Documentation
Overview
The ConnectHub iOS SDK provides a comprehensive, type-safe Swift interface for integrating ConnectHub's social features directly into your native applications. Build authenticated feeds, real-time messaging, content sharing, and analytics with minimal boilerplate.
This SDK is designed for Swift concurrency. Use async/await throughout your codebase for the best developer experience and performance.
Requirements
| Component | Minimum Version | Recommended |
|---|---|---|
| iOS SDK | 15.0 | 17.0+ |
| Xcode | 14.0 | 15.2+ |
| Swift | 5.5 | 5.9+ |
| Architecture | arm64, x86_64 (sim) | arm64 only (production) |
Installation
Choose your preferred dependency manager. We recommend Swift Package Manager for modern Xcode projects.
Swift Package Manager
CocoaPods
Carthage
Quick Start
Get up and running in under 5 minutes. Follow these three steps to initialize the SDK and make your first API call.
1. Initialize the SDK
Add this to your AppDelegate or @main App struct:
2. Authenticate a User
3. Fetch the Home Feed
Never expose your server-side API keys or client secrets in iOS code. Use secure token exchange via your backend.
Configuration
Customize SDK behavior using the ConnectHubConfig singleton. Available options:
| Property | Type | Description | Default |
|---|---|---|---|
timeout |
TimeInterval |
Network request timeout | 30.0 |
maxRetries |
Int |
Automatic retry attempts | 3 |
cachePolicy |
CachePolicy |
Response caching strategy | .returnCacheThenLoad |
analyticsEnabled |
Bool |
Opt-in telemetry collection | true |
logLevel |
LogLevel |
Debug verbosity | .warning |
API Reference Highlights
Explore the most commonly used modules. Full documentation is generated via SwiftDocC and available in Xcode.
Authentication
login(token:)- Authenticate with server JWTlogout()- Clear session & local cachecurrentUser- Access current session dataonAuthStateChanged- Observe session transitions
Content & Feed
fetch(type:limit:cursor:)- Paginated feed loadingcreate(post:)- Publish media/text contentupdate(postId:modifications:)- Edit existing postslike(postId:)` / `unlike(postId:)- Engagement actions
Messaging
openChat(userId:)- Launch 1:1 conversationsendMessage(text:attachments:)- Send rich messageslistenToMessages(chatId:)` - Real-time stream
Callback-based APIs have been deprecated. All asynchronous operations now use async/await. Update legacy code to avoid build warnings.
Support & Community
Need help? We're here to ensure your integration is smooth.
- 📖 Full API Reference: Available directly in Xcode via SwiftDocC
- 💬 Developer Community: Join our Discord for real-time Q&A
- 🐛 Report Issues: File a bug on GitHub Issues
- 📧 Enterprise Support: support@connecthub.dev