How shoheitakino/pokemonappwithswiftuimvvm works
Project Overview & Type
• This is an iOS mobile application developed in Swift using SwiftUI.
• The architecture follows MVVM augmented with a centralized “Store” (or Dispatcher) pattern to manage data throughout the session.
• The purpose is to fetch Pokémon data through an API and hold it in a single data source, ensuring a consistent and unified state across the app.
Analyzing the File Structure
• APIClient: Contains network-handling components such as FetchPokemonData.swift, PokemonApiClient.swift, and a subdirectory “Model” that defines the API’s response formats.
• Core & Entity: “Core” (e.g., Constants.swift) holds constant values used app-wide; “Entity” (e.g., PokemonEntity.swift) defines data models.
• PokemonDispatcher: Implements state management components like PokemonFavoriteDispatcher, PokemonFavoriteStore, and PokemonStore. This layer is the “store” that maintains the single source of truth for the application.
• Presentation: Contains multiple subfolders for various screens (LaunchScreen, MainTab, PokemonList, PokemonDetail, PokemonLazyVGrid, and FavoritePokemonList) along with their corresponding ViewModels. The entry point for the app is also under MainTab.
• ViewModel: Contains additional shared ViewModel logic (such as PokemonDataViewModel.swift).