Draw Idea is a modern SwiftUI iOS game for two nearby players:
- Player 1 writes a sentence.
- Player 2 draws that sentence.
- The writer sees drawing updates in real time.
The app uses MultipeerConnectivity for local peer-to-peer communication (Bluetooth / peer-to-peer Wi-Fi / local Wi-Fi).
- Two-player session flow:
- Create session (host)
- Join session (discover nearby host)
- Real-time collaboration:
- Live stroke sync while drawing
- Writer sees drawing updates instantly
- Role-based gameplay:
- Sentence Writer
- Drawer
- Drawing tools:
- Color palette selection
- Smooth freehand strokes
- Done drawing action
- Round management:
- New round reset
- Keep playing multiple rounds in one session
- Connection UX:
- Clear connection states (hosting, browsing, inviting, connecting, failed)
- Dedicated “player joined” and continue actions
- Reconnect session button
- Auto reconnect attempt on app resume after lock/background disconnect
- Device behavior improvements:
- Keeps screen awake during active hosting/session (
isIdleTimerDisabled) - Tap anywhere to dismiss keyboard
- Keeps screen awake during active hosting/session (
- Open app on two devices.
- Device A taps Create Session.
- Device B taps Join Session and selects host.
- Once connected, continue to role selection.
- Pick opposite roles:
- Writer enters sentence and sends it.
- Drawer receives sentence and starts drawing.
- Writer watches live drawing updates.
- Drawer taps Done Drawing.
- Tap New Round to play again.
- Transport is automatically chosen by Apple via
MultipeerConnectivity. - Bluetooth is supported, but not forced exclusively (system may use Wi-Fi/P2P).
- If a lock/background interruption drops the link, the app can show reconnect and retry.
The app includes required local-network Bonjour keys:
NSLocalNetworkUsageDescriptionNSBonjourServiceswith"_drawidea._tcp."
draw-idea/ContentView.swift- Main UI screens and flowdraw-idea/SessionManager.swift- Session state + peer networking logicdraw-idea/Models.swift- Shared models/enums for game + connection statesInfo.plist- App permissions and Bonjour settings
- Xcode (recent version with SwiftUI support)
- Two physical iOS devices for realistic nearby testing
- Open
draw-idea.xcodeproj. - Build and run on two physical devices.
- Accept Local Network permission when prompted.
- Start one host and one joiner.
- Session continuity across screen lock/background depends on iOS lifecycle behavior.
MultipeerConnectivitytransport selection is system-managed.- Best experience is on real devices (simulator may be unreliable for nearby networking).