A comprehensive collection of Swift libraries for iOS, macOS, watchOS, and visionOS development, providing essential functionality for modern Apple platform applications.
Structured logging with multiple levels, category-based filtering, and Console.app integration.
- Getting Started - Quick start guide with examples
- Multiple log levels (error, warning, info, debug) with emoji indicators
- File filtering and source location tracking
- Real-time enable/disable control
Convenient extensions for common Swift types and data obfuscation utilities.
- Getting Started - Usage examples and best practices
- String, Date, Data, Dictionary, and Bundle extensions
- Obfuscator for sensitive data protection
- Codable utilities for JSON handling
Type-safe wrappers for UserDefaults, Keychain, and HTTP Cookies.
- Getting Started - Installation and basic usage
- Biometric Storage - Secure storage with Touch ID/Face ID
- Keychain with biometric authentication support
- Persistent cookie management
StoreKit 2 wrapper for in-app purchases and subscriptions.
- Getting Started - Complete purchase flow guide
- Async/await API with Combine status updates
- Automatic transaction verification
- Purchase restoration support
Firebase Analytics integration with type-safe event tracking.
- Getting Started - Setup and basic tracking
- Protocol-oriented design for multiple analytics providers
- Firebase Analytics provider with automatic parameter sanitization
- Type-safe event definitions with associated values
- Session tracking with automatic lifecycle management
- SwiftUI modifiers for screen, interaction, and navigation tracking
- NavigationStack integration with automatic destination tracking
- Navigation depth monitoring for user flow analysis
Modern async/await networking layer with mocking and environment support.
- Getting Started - Environment setup and usage
- Protocol-oriented with dependency injection
- Built-in mocking for testing
- Comprehensive error handling
Reusable SwiftUI components for all Apple platforms.
- Getting Started - Component usage guide
- Cached async image loading with Kingfisher
- Circular progress indicators
- Custom error views
- Some cross-platform compatibility
- Lottie animations integration
- PDF viewer and document browser
- WebView components
- Avatar views and search bars
- App Store review requests
YouTubeLibrary (iOS Only)
YouTube Data API v3 integration with SwiftUI components.
- Quick Start - Installation and basic setup
- Configuration - Advanced configuration options
- Playlist video fetching with pagination
- Video search and filtering with favorites
- Customizable video card styles (Classic, Modern)
- WebKit-based player with playback controls
- SwiftData persistence with playback state
- Obfuscated credential storage
Add KSLibrary to your project using Swift Package Manager:
dependencies: [
.package(url: "https://github.com/cassio-rossi/Libraries.git", from: "1.0.0")
]Then add the specific libraries you need to your target:
.target(
name: "YourTarget",
dependencies: [
.product(name: "Logger", package: "Libraries"),
.product(name: "Utilities", package: "Libraries"),
.product(name: "Storage", package: "Libraries"),
.product(name: "InApp", package: "Libraries"),
.product(name: "Analytics", package: "Libraries"),
.product(name: "Network", package: "Libraries"),
.product(name: "UIComponents", package: "Libraries"),
.product(name: "YouTube", package: "Libraries")
]
)import LoggerLibrary
let logger = Logger(category: "MyApp")
logger.info("User logged in successfully")
logger.error("Failed to fetch data: \(error)")import UtilityLibrary
let dateString = "20/03/2024"
let date = dateString.toDate()
let formatted = Date().toString(format: .dateOnly)import StorageLibrary
let storage = DefaultStorage()
storage.save("John Doe", for: "username")
let name: String? = storage.read(for: "username")import InAppLibrary
let inAppManager = InAppManager()
let products = try await inAppManager.getProducts(for: ["com.myapp.premium"])
await inAppManager.purchase(products.first!)import AnalyticsLibrary
let analytics = AnalyticsManager()
// Track screen views
analytics.track(.screenView(current: "Home", previous: nil), providers: [.firebase])
// Track user interactions
analytics.track(.buttonTap(id: "add_to_cart", screen: "ProductDetail"), providers: [.firebase])
// Track purchases
analytics.track(.purchaseCompleted(transactionId: "TX123", revenue: 9.99), providers: [.firebase])import NetworkLibrary
let host = CustomHost(host: "api.example.com", path: "/v1")
let network = NetworkFactory.make(host: host)
let endpoint = Endpoint(customHost: host, api: "/users")
let data = try await network.get(url: endpoint.url)import UIComponents
CachedAsyncImage(url: imageURL, placeholder: Image(systemName: "photo"))
CircularProgressView(progress: 0.75, lineWidth: 10)
ErrorView(message: "Something went wrong", retryAction: { /* retry */ })import UIComponents
LottieView(asset: MyLottieAsset.loading, loopMode: .loop)
PDFViewer(url: documentURL)
SearchBar(text: $searchText, placeholder: "Search...")import YouTubeLibrary
let credentials = YouTubeCredentials(
salt: "your-salt",
keys: [obfuscatedKey1, obfuscatedKey2],
playlistId: obfuscatedPlaylist,
channelId: obfuscatedChannel
)
let api = YouTubeAPI(credentials: credentials)
// Display videos with default modern card style
Videos(api: api, search: searchText)
// Or use custom card style
Videos(api: api, card: ClassicCard.self)Each library includes comprehensive DocC documentation with:
- Detailed API reference
- Getting started guides
- Usage examples
- Best practices
- Troubleshooting tips
Click on any library name above to access its documentation.
Contributions are welcome! Feel free to submit issues or pull requests.
See the LICENSE file for details.