Skip to content

pespinel/RAWGKit

Repository files navigation

RAWGKit

CI codecov Swift Version Platforms SPM Compatible License

A modern, Swift-native SDK for the RAWG Video Games Database API with first-class SwiftUI support.

πŸ“š Documentation

Read the complete documentation β†’

Comprehensive guides including:

  • Getting Started
  • SwiftUI Integration
  • Advanced Features (Query Builder, Pagination, AsyncSequence)
  • Security Best Practices
  • Performance Optimization
  • Complete API Reference

Features

  • 🎨 SwiftUI First-Class - Ready-to-use ViewModels and UI components
  • βœ… Complete API Coverage - All RAWG endpoints (games, platforms, genres, stores, creators)
  • πŸ”’ Type-Safe - Fully typed with Codable models and compile-time safe filters
  • ⚑ Modern Swift - Built with async/await and AsyncSequence
  • 🎯 Actor-Based - Thread-safe networking with request deduplication
  • πŸ“± Cross-Platform - iOS 15+, macOS 13+, watchOS 8+, tvOS 15+, visionOS 1+
  • πŸ”¨ Fluent Query Builder - Type-safe API with enums
  • πŸ”„ Auto-Pagination - Stream results with AsyncSequence
  • πŸ’Ύ Smart Caching - In-memory with TTL
  • πŸ” Automatic Retries - Exponential backoff
  • πŸ” Security - Certificate pinning, Keychain storage, input validation

Requirements

  • Swift 6.0+
  • iOS 15.0+ / macOS 13.0+ / watchOS 8.0+ / tvOS 15.0+ / visionOS 1.0+
  • Xcode 16.0+

Installation

Swift Package Manager

Add to your Package.swift:

dependencies: [
    .package(url: "https://github.com/pespinel/RAWGKit", from: "3.2")
]

Or in Xcode: File β†’ Add Packages... and enter https://github.com/pespinel/RAWGKit

Quick Start

Get Your API Key

  1. Visit https://rawg.io/apidocs
  2. Create an account and get your free API key

Basic Usage

import RAWGKit

let client = RAWGClient(apiKey: "YOUR_API_KEY_HERE")

// Fetch popular games
let games = try await client.fetchGames(pageSize: 10, ordering: "-rating")
for game in games.results {
    print("\(game.name) - Rating: \(game.rating)")
}

SwiftUI Example

import RAWGKit
import SwiftUI

struct GamesListView: View {
    @StateObject private var viewModel = GamesViewModel(
        client: RAWGClient(apiKey: "YOUR_API_KEY_HERE")
    )

    var body: some View {
        List(viewModel.games) { game in
            GameRowView(game: game)
        }
        .searchable(text: $viewModel.searchText)
        .task { await viewModel.loadGames() }
    }
}

Query Builder

let response = try await client.gamesQuery()
    .search("witcher")
    .platforms([.pc, .playStation5])
    .genres([.rpg, .action])
    .metacriticMin(80)
    .orderByRating()
    .execute(with: client)

Examples

Check out the Examples/ directory:

Testing & Quality

  • βœ… 389 tests passing - Comprehensive test coverage
  • βœ… SwiftLint strict mode - Code quality enforcement
  • βœ… SwiftFormat - Automated formatting
  • βœ… Strict Concurrency - Maximum safety
  • βœ… CI/CD - Automated testing on macOS

Contributing

Contributions are welcome! See CONTRIBUTING.md for details.

Quick start for contributors:

make setup       # Install tools and git hooks
make test        # Run tests
make pre-commit  # Format, lint, and test

License

MIT License - see LICENSE file for details.

Acknowledgments

  • Data provided by RAWG.io
  • Built with Swift 6.0 and modern concurrency

Support

About

A swift-native SDK for the RAWG Video Games Database API.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 2

  •  
  •