Skip to content

alifu/PokeAPI-SwiftUI

Repository files navigation

PokeAPI SwiftUI

A comprehensive iOS Pokemon application built with SwiftUI, featuring a complete Pokedex with search, sorting, and detailed Pokemon information. This project demonstrates modern iOS development practices including MVVM architecture, reactive programming with Combine, and comprehensive unit testing.

🚀 Features

  • Complete Pokedex: Browse through all Pokemon with pagination
  • Advanced Search: Case-insensitive search functionality
  • Smart Sorting: Sort Pokemon by name or number
  • Detailed Views: Comprehensive Pokemon details with stats, abilities, and types
  • Offline Support: Local database caching with Realm
  • Modern UI: Beautiful SwiftUI interface following Pokemon design guidelines
  • Comprehensive Testing: Full unit test coverage with 100% passing tests

🏗️ Architecture

This project uses MVVM (Model-View-ViewModel) architecture with the following components:

  • Models: Data structures for Pokemon, Pokedex, and API responses
  • ViewModels: Business logic and data binding with Combine
  • Views: SwiftUI user interface components
  • Services: API service and database operations
  • Utilities: Helper functions and extensions

📦 Dependencies

This project uses Swift Package Manager (SPM) for dependency management:

  • Alamofire → HTTP networking and API communication
  • Nuke → Image downloading and caching with performance optimization
  • Realm → Local database for offline data persistence
  • Wormholly → Network debugging and API monitoring

🧪 Testing

This project includes a comprehensive unit test suite with:

  • 9 Test Files covering all major components
  • 35+ Test Methods with 100% passing rate
  • Complete Coverage: Models, ViewModels, Services, and Utilities
  • Mock Services: Isolated testing with MockAPIService and MockRealmService
  • Async Testing: Proper handling of Combine publishers and async operations
  • Edge Cases: Comprehensive testing of error conditions and boundary cases

Test Categories:

  • Model Tests: JSON decoding, data validation, and edge cases
  • ViewModel Tests: Business logic, search, sorting, and async operations
  • Service Tests: API communication and database operations
  • Utility Tests: Helper functions and extensions

For detailed testing information, see PokeAPI-SwiftUITests/README.md

✅ Completed Features

  • Dependency Management: Swift Package Manager integration
  • Local Database: Realm integration for offline data persistence
  • Pokedex Implementation: Complete Pokemon listing with API integration
  • Search Functionality: Case-insensitive Pokemon search
  • Sorting System: Sort Pokemon by name or number
  • Detail Pages: Comprehensive Pokemon information display
  • Unit Testing: Complete test suite with 100% passing tests
  • MVVM Architecture: Clean separation of concerns
  • Combine Integration: Reactive programming patterns
  • Error Handling: Comprehensive error management
  • Mock Services: Isolated testing infrastructure
  • Navigation: Previous/next Pokemon in detail pages

🚧 Future Enhancements

  • Poppins Font: Custom typography implementation
  • Widgets: iOS home screen widgets
  • Pagination: Load more functionality for large datasets
  • Accessibility: Enhanced accessibility features
  • Localization: Multi-language support
  • Performance: Image optimization and caching improvements

🏃‍♂️ Getting Started

Prerequisites

  • iOS 14.0+
  • Xcode 12.0+
  • Swift 5.0+

Installation

  1. Clone the repository
  2. Open PokeAPI-SwiftUI.xcodeproj in Xcode
  3. Build and run the project

Running Tests

# Run all tests
xcodebuild test -scheme PokeAPI-SwiftUI -destination 'platform=iOS Simulator,name=iPhone 15'

# Or use Xcode: Cmd + U

📊 Application Flow

Home Journey

Home Logic

Detail Journey

Detail Logic

API Fetching Journey

API Logic

Search Journey

Search Logic

🎨 Design

UI design inspired by Pokédex Community Design

📝 License

This project is part of my portfolio and demonstrates modern iOS development practices including:

  • MVVM architecture implementation
  • SwiftUI and Combine integration
  • Comprehensive unit testing
  • API integration and data persistence
  • Clean code principles and best practices

Portfolio Project - Created to showcase iOS development skills and technical expertise.

About

This project is part of my iOS development portfolio

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages