iOS Swift SDK
The FansUnitedSDK is a Kotlin Multiplatform Mobile SDK that provides comprehensive access to the Fans United platform APIs. This documentation covers Swift/iOS integration patterns, initialization, and usage examples.
Features
- Profile Operations - User profile management
- Football Operations - Football-related data and functionality
- Predictor Operations - Match prediction features
- Top X Operations - Top X games prediction featurees
- Match Quiz Operations - Match Quiz games prediction features
- Loyalty Operations - Loyalty and leaderboards featurees
- Activity Operations - User activity tracking and management
- Discussion Operations - Community discussion features
Installation
Requirements
- iOS 12.0+
- Xcode 12.0+
- Swift 5.3+
CocoaPods
Add the following line to your Podfile
:
pod 'FansUnitedSDK'
or for specific version:
pod 'FansUnitedSDK', '~> 1.1.0'
Then run:
pod install
SDK Configuration
Required Configuration Parameters
The SDK requires the following configuration parameters:
import FansUnitedSDK
let config = FUSDKConfig(
apiKey: String, // Your API key
clientId: String, // Your client identifier
lang: String, // Language code (e.g., "en")
idSchema: IDSchema, // ID schema for data mapping
environment: String, // "production" or "staging"
authProvider: IFUSDKTokenProvider // Authentication provider
)
Available ID Schemas
IDSchema.native // Fans United Default
IDSchema.enetpulse // Enetpulse data provider
IDSchema.sportradar // Sportradar data provider
IDSchema.sportal365 // Sportal365 data provider
IDSchema.apifootball // API Football data provider
Authentication
Token Provider Implementation
Implement the IFUSDKTokenProvider
protocol:
class AuthProvider: IFUSDKTokenProvider {
private let authToken: String
func getToken() async throws -> String? {
// Return your authentication token
return authToken
}
func logout() async throws {
// Handle logout logic
}
}
SDK Initialization
// Create token provider
let authProvider = AuthProvider(token: "your-auth-token")
// Configure SDK
let config = FUSDKConfig(
apiKey: "your-api-key",
clientId: "your-client-id",
lang: "en",
idSchema: IDSchema.apifootball,
environment: "production",
authProvider: authProvider
)
// Initialize SDK
let sdk = FansUnitedSDK.Companion.shared.doInit(config: config)
Core Modules
The SDK provides access to several modules through async methods:
Available Modules
// Football operations
let footballManager = try await sdk.football()
// User profile operations
let profileManager = try await sdk.profile()
// Prediction operations
let predictorManager = try await sdk.predictor()
// Match quiz operations
let matchQuizManager = try await sdk.matchQuiz()
// Top X leaderboards
let topXManager = try await sdk.topX()
// Loyalty program
let loyaltyManager = try await sdk.loyalty()
// Activity tracking
let activityManager = try await sdk.activity()
// Discussions
let discussionsManager = try await sdk.discussions()
Updated 10 days ago