A Swift package for integrating Aitronos functionality into your iOS and macOS applications.
- iOS 13.0+ / macOS 10.15+
- Swift 6.0+
- Xcode 15.0+
Add the following dependency to your Package.swift file:
dependencies: [
.package(url: "https://github.com/yourusername/aitronos-swift-package.git", from: "1.0.0")
]Or in Xcode:
- File > Add Packages...
- Enter the repository URL:
https://github.com/yourusername/aitronos-swift-package.git - Select the version you want to use
The package provides several key components:
The StreamApiClient class handles real-time data streaming operations.
The App-Hive module provides functionality for:
- Managing application state
- Handling data synchronization
- Processing real-time updates
The Freddy API module offers:
- API client implementation
- Data models
- Network request handling
import aitronos
// Initialize the client
let client = StreamApiClient()
// Configure your API settings
client.configure(apiKey: "your-api-key")// Start a stream
client.startStream { result in
switch result {
case .success(let data):
// Handle streaming data
print("Received data: \(data)")
case .failure(let error):
// Handle any errors
print("Error: \(error)")
}
}// Initialize App-Hive components
let appHive = AppHive()
// Set up data synchronization
appHive.setupSync { result in
// Handle sync completion
}// Use Freddy API client
let freddyClient = FreddyApiClient()
// Make API requests
freddyClient.makeRequest { response in
// Handle API response
}- Always handle errors appropriately
- Implement proper authentication
- Follow the recommended initialization sequence
- Use appropriate error handling and logging
- Implement proper cleanup when shutting down streams
The package uses Swift's native error handling system. Common errors include:
enum AitronosError: Error {
case connectionFailed
case invalidAuthentication
case streamError
// ... other error cases
}The package is designed to be thread-safe. However, ensure you're making API calls from the appropriate threads:
- Network operations are performed asynchronously
- UI updates should be performed on the main thread
- Heavy processing is done on background threads
For advanced use cases, you can customize the behavior:
let config = AitronosConfig(
timeout: 30,
retryCount: 3,
logLevel: .debug
)
client.configure(with: config)The package includes comprehensive logging capabilities:
// Enable detailed logging
AitronosLogger.setLevel(.debug)
// Custom log handlers
AitronosLogger.setHandler { level, message in
// Handle log messages
}Contributions are welcome! Please feel free to submit a Pull Request.
This package is released under the MIT License. See LICENSE for details.
For support, please:
- Check the documentation
- Search for existing issues
- Create a new issue if needed
- 1.0.0
- Initial release
- Basic streaming functionality
- App-Hive integration
- Freddy API support