[Foundation/Feature] Pokémon Evolution Dex — scaffold, domain models & parallel family loading#2
Open
SongMY01 wants to merge 11 commits into
Open
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Pokemon: id, name, imageURL, types; conforms to Identifiable - PokemonFamily: one evolution chain holding id and stages Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- fetchEvolutionChain(id:): returns ids in evolution order - fetchDetail(id:): detail including image and types - Conforms to Sendable Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Calls PokeAPI and decodes responses - Flattens the evolution-chain tree into evolution order - Separate DTOs for decoding responses Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Fetches families and stages concurrently via outer/inner TaskGroups - Restores arrival order using the chain order (speciesIDs) - Ensures concurrency safety with @mainactor and Sendable Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Bundles PretendardVariable.ttf and registers it at launch (CTFontManager) - Adds Font/UIFont helpers with variable weight and Dynamic Type - Sets the navigation bar title font Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- ContentView shows each family as a card; horizontal scroll for 4+ stages - Adds PokemonTypeStyle mapping 18 official type colors - Type-color gradient cards, type badges, Pokedex numbers, light theme Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- pokemon/README.md: overview, architecture, and concurrency implementation Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Automatic code signing / development team settings - Ignore .DS_Store and Xcode user data Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this solve?
Builds a SwiftUI Pokédex on the PokeAPI for the Swift Concurrency Lab.
Shows how
async/await,TaskGroup, and@MainActorbehave in a real app by loading 50 evolution families + every stage's detail (~150 requests) in parallel — sequentially ~45s, in parallel ~0.6s.Approach
Pokemon,PokemonFamily(one evolution chain per card)protocol PokemonService: Sendable(async/throws).PokemonServiceImpldecodes JSON via private DTOs — external shape never leaks past the boundary. ViewModel depends only on the protocol → mock injectable for Testing Lab later.@MainActor, orchestrates concurrency with nested TaskGroupsConcurrency Core
[id: Pokemon], thenspeciesIDs.compactMap { byID[$0] }restores evolution order@MainActorkeeps@Publishedupdates on main;Sendablelets the service cross task boundaries;loadFamilyisstatic+ arg-passed so it never captures the MainActorselfDiagram
Review Focus
families = []— should partial results survive instead?Pokemon/PokemonFamilyfield shapes right for the UI?PokemonServiceboundary (async/throws/Sendable) the right contract?Out of Scope / Follow-up
PokemonService, success/failure/timeout/cancellation)