Brett Owers
← All Projects

HPGModelsKit

Archived

April 16, 2025

Another CocoaPod for Hot Potato Games — this one containing shared data models for interacting with the HPG backend. The companion to HPGCryptoKit, and a lesson in when shared model packages make sense and when they are premature.

Purpose

Created a shared data models package for the Hot Potato Games iOS apps — typed Swift structs and Codable conformances for every backend API response. The idea: any HPG app imports HPGModelsKit and gets type-safe access to user profiles, game sessions, leaderboards, and whatever else the backend serves.

Stack

SwiftCocoaPodsiOSCodableData ModelsHot Potato Games

What I Learned

  • Shared model packages make sense when: multiple apps consume the same backend, the API surface is stable, and type mismatches between apps would cause real bugs. They are premature when: you have one app, the API is still changing weekly, and the "shared" package is shared with nobody.
  • Swift's Codable protocol makes JSON ↔ struct serialization trivial: define a struct with the right property names and types, conform to Codable, and JSONDecoder handles the rest. A models package is essentially a collection of these structs with any custom decoding logic (date formats, nested objects, enum mapping). The package is simple. The value is consistency.
  • HPGModelsKit + HPGCryptoKit together represent the beginning of a layered SDK: models for data, crypto for security, and presumably networking, storage, and UI layers would follow. This is how companies like Stripe and Firebase structure their client SDKs — small, composable packages that apps import as needed. For HPG at current scale, it was premature. For HPG at target scale, it is correct.

Key Insights

  • Building SDK infrastructure before you have multiple consumers is a form of optimistic architecture — betting that the future will need what you are building today. Sometimes the bet pays off (the SDK is ready when the second app ships). Sometimes it does not (the API changes so much that the models package is rewritten before anyone uses it). The meta-skill is knowing which bets to make.
#Swift#CocoaPods#iOS#data-models#Codable#Hot-Potato-Games#SDK#API#infrastructure

This post was composed through a conversation between Brett Owers and Claude Code (Anthropic). The content reflects Brett's recollection of each project and the lessons drawn from it. Some details may be approximate or omitted — the purpose is to paint an honest picture of a software engineer's development over time, not to serve as a precise historical record.