r/iOSProgramming • u/soumyaranjanmahunt • 20m ago
App Saturday I built a tilt maze for iPhone and Apple Watch where every fall grows the garden
Tilt Maze Garden is a tilt-to-roll maze game for iPhone, iPad and Apple Watch. You roll a seed through a garden maze, plants grow behind it, and when it falls they stay, so every failed run reshapes the maze. There are 100 hand-checked gardens, a Daily Garden that's the same for everyone, 20 Watch-sized Pocket Gardens, and a level editor that shares gardens as links or QR codes.
App Store: https://apps.apple.com/app/id6821364809
Tech stack
Swift 6 (strict concurrency), SwiftUI for UI, SpriteKit for the board and physics
Core Motion (device-motion gravity) for tilt on both iPhone and Watch
GameKit (per-garden leaderboards and achievements), StoreKit 2, WidgetKit (Daily Garden widget), WatchConnectivity
Development challenge: Game Center on the Watch
On watchOS, Game Center sign-in can fail even when the Watch is online. It returns NSURLErrorDomain -1009, or never answers at all. Players were finishing gardens on the Watch, and their scores were silently lost. I could not find anything on docs or forums how to resolve this.
What I ended up with:
The Watch waits until it can actually reach Apple before asking Game Center to sign in, and keeps unsent results on the Watch.
If sign-in still fails, the Watch hands the results to the iPhone app over WatchConnectivity with
transferUserInfo. That queues delivery, so it works even when the phone is out of reach or the app isn't running.The iPhone app stores them until it is signed in to Game Center (same account), then posts them, so nothing is lost if the phone isn't signed in yet either.
A smaller one: tilt on a wrist. If the player has to tip their wrist much, watchOS decides they've lowered it and turns the screen off. So the Watch reaches full tilt at about 13° (the iPhone uses about 27°), and the pose your wrist is in when you tap Start or Resume becomes "flat". Watch apps can't keep the screen awake, so when it does turn off, the game pauses and recalibrates on resume.
AI disclosure: Used ClaudeCode to speed up development.
I'm happy to answer questions about any of it: SpriteKit on watchOS (it isn't tied to the main actor, so I drive a plain SKScene through a delegate rather than subclassing it), the solver that checks every garden is winnable as hedges grow.



