Skip to content

mdo91/draw-idea

Repository files navigation

Draw Idea

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).

Features

  • 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

App Flow

  1. Open app on two devices.
  2. Device A taps Create Session.
  3. Device B taps Join Session and selects host.
  4. Once connected, continue to role selection.
  5. Pick opposite roles:
    • Writer enters sentence and sends it.
    • Drawer receives sentence and starts drawing.
  6. Writer watches live drawing updates.
  7. Drawer taps Done Drawing.
  8. Tap New Round to play again.

Connectivity Notes

  • 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.

Permissions / Info.plist

The app includes required local-network Bonjour keys:

  • NSLocalNetworkUsageDescription
  • NSBonjourServices with "_drawidea._tcp."

Project Structure

  • draw-idea/ContentView.swift - Main UI screens and flow
  • draw-idea/SessionManager.swift - Session state + peer networking logic
  • draw-idea/Models.swift - Shared models/enums for game + connection states
  • Info.plist - App permissions and Bonjour settings

Requirements

  • Xcode (recent version with SwiftUI support)
  • Two physical iOS devices for realistic nearby testing

Run Locally

  1. Open draw-idea.xcodeproj.
  2. Build and run on two physical devices.
  3. Accept Local Network permission when prompted.
  4. Start one host and one joiner.

Known Limitations

  • Session continuity across screen lock/background depends on iOS lifecycle behavior.
  • MultipeerConnectivity transport selection is system-managed.
  • Best experience is on real devices (simulator may be unreliable for nearby networking).

About

draw idea is an iOS app that two devices can work on via bluetooth connection, one writes a sentence and other starts drawing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

 
 
 

Contributors

Languages