Skip to content

[iOS] Vishwas — PokeDex Assignment#2

Open
vishwas-kr wants to merge 7 commits into
Robustrade:mainfrom
vishwas-kr:ios/feature/vishwas
Open

[iOS] Vishwas — PokeDex Assignment#2
vishwas-kr wants to merge 7 commits into
Robustrade:mainfrom
vishwas-kr:ios/feature/vishwas

Conversation

@vishwas-kr

Copy link
Copy Markdown

Overview

This project is a SwiftUI-based iOS app built using an MVVM architecture with a clean separation between the shared Kotlin Multiplatform (KMP) module and the native UI layer.

The shared module handles business logic, data models, networking, and local persistence, while the iOS layer focuses purely on UI and user interaction.


Architecture

  • MVVM + KMP

    • Shared ViewModels, repositories, networking, and database live in the KMP module
    • SwiftUI layer renders UI and binds to state
  • Dependency Injection

    • Powered by Koin
    • Initialized via KoinDependencies at app launch
  • State Management

    • Kotlin StateFlow is bridged into SwiftUI using a custom FlowCollector
    • observe(as:onChange:) ensures updates are delivered on the main thread
  • Stores (iOS Layer)

    • Each screen has a @MainActor ObservableObject Store
    • Responsibilities:
      • Wrap KMP ViewModel
      • Sync initial state
      • Observe StateFlow
      • Forward user actions
      • Call viewModel.onCleared() in deinit for cleanup

Features

1. Pokémon List

  • Two-column grid (LazyVGrid)
  • Infinite scrolling with pagination
  • Search support using .searchable
  • Pull-to-refresh (.refreshable)
  • Handles loading, error, and empty states

2. Pokémon Detail

  • Structured UI with sections:
    • Header (image, ID, types)
    • Info (height, weight)
    • Stats (progress bars)
    • Abilities (adaptive grid)
  • Favourite toggle with persistence
  • Formatting handled in Store/Formatter (not in views)

3. Favourites

  • Reactive list using LazyVStack
  • Synced with local database (SQLDelight via KMP)
  • Automatically updates when favourites change
  • Empty state when no favourites exist

Navigation

  • TabView with two tabs:
    • Pokédex
    • Favourites
  • Each tab uses its own NavigationStack
  • Navigation via .navigationDestination

Screenshots

List Search Detail
EmptyFavourites Favourites

##Video

pokedex.mp4

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a complete iOS Pokédex app using SwiftUI with MVVM architecture, leveraging Kotlin Multiplatform (KMP) for shared business logic. The app demonstrates a clean separation between the native iOS UI layer and the shared KMP module, with comprehensive state management through Kotlin StateFlow observable in SwiftUI. The implementation includes pagination, search functionality, favorites persistence, and detailed Pokémon information display.

Changes:

  • Added complete SwiftUI UI layer with MVVM stores wrapping KMP ViewModels
  • Implemented state management bridge from Kotlin StateFlow to SwiftUI via FlowCollector
  • Created dependency injection layer (KoinDependencies) for resolving shared module dependencies from Swift
  • Added comprehensive view components for list, detail, and favorites screens with proper error and empty states
  • Included theme and formatting utilities for consistent UI presentation

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
iosApp/iosApp/Views/ SwiftUI views for Pokédex list, detail, and favorites screens with search and pagination support
iosApp/iosApp/ViewModels/ @MainActor Store classes providing state management and binding between KMP ViewModels and SwiftUI views
iosApp/iosApp/Components/ Reusable SwiftUI components for grid cells, stat bars, type chips, and image loading
iosApp/iosApp/Helpers/ FlowCollector bridge for Kotlin StateFlow observation, Koin dependency resolution, and formatting utilities
iosApp/iosApp/Theme/ Color definitions for Pokémon types and app theme
iosApp/Podfile CocoaPods configuration specifying iOS 16.0 minimum deployment target and shared KMP pod
iosApp/shared.xcframework/ XCFramework configuration files for the shared KMP module

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread iosApp/iosApp/Views/Favourites/FavoritesView.swift
Comment thread iosApp/iosApp/ViewModels/PokemonDetailStore.swift Outdated
Comment thread iosApp/iosApp/ViewModels/PokemonListStore.swift Outdated
Comment thread iosApp/iosApp/Views/PokemonList/Components/PokemonListError.swift Outdated
Comment thread iosApp/iosApp/Views/PokemonDetail/Components/PokemonAbilities.swift
Comment thread iosApp/Podfile Outdated
Comment thread iosApp/iosApp/Views/PokemonList/PokemonListView.swift Outdated
Comment thread iosApp/iosApp/Views/PokemonList/Components/PokemonGrid.swift Outdated
Comment thread iosApp/iosApp/Components/StatBarView.swift Outdated
Comment thread iosApp/shared.xcframework/ios-arm64/shared.framework/Info.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants