Layover Development Guide
Project Structure
Layover/
├── Sources/
│ ├── Models/ # Data models (User, Room, etc.)
│ ├── ViewModels/ # MVVM ViewModels
│ ├── Views/ # SwiftUI Views
│ ├── Services/ # Business logic services
│ └── LayoverApp.swift # App entry point
├── Tests/
│ ├── Models/ # Model unit tests
│ ├── ViewModels/ # ViewModel unit tests
│ └── Services/ # Service unit tests
├── Resources/
│ ├── Info.plist
│ └── Layover.entitlements
└── Package.swift
Architecture
MVVM Pattern
- Models: Pure data structures (User, Room, MediaContent, ChessGame)
- ViewModels: Observable objects that manage business logic and state
- Views: SwiftUI views that observe ViewModels
- Services: Protocol-based services for SharePlay, rooms, media, and games
Key Components
SharePlay Integration
SharePlayService: Manages GroupSessions and AVPlaybackCoordinator
LayoverActivity: GroupActivity for synchronized experiences
- Automatic coordination for video and audio playback
Room Management
RoomService: Create, join, leave, and manage rooms
- Support for host and sub-host roles
- Multiple concurrent rooms with different activities
Activity Types
- Apple TV+: Synchronized video playback with AVPlayerPlaybackCoordinator
- Apple Music: Synchronized music playback with MusicKit
- Chess: Turn-based strategy game with SharePlay support
Testing
Running Tests
Test Coverage
- Model tests: User, Room, ChessGame, ChessPiece
- Service tests: RoomService, ChessService
- ViewModel tests: RoomListViewModel, ChessViewModel
iOS (17.0+)
- Full feature set
- Portrait and landscape orientations
- SharePlay support
macOS (14.0+)
- Native Mac Catalyst app
- Full feature parity with iOS
tvOS (17.0+)
- Optimized for Apple TV
- Focus-based navigation
- SharePlay for group viewing
visionOS (1.0+)
- Spatial computing support
- Immersive SharePlay experiences
- 3D chess board (future enhancement)
Configuration
Entitlements Required
com.apple.developer.group-session: SharePlay support
com.apple.developer.playable-content: Media playback
com.apple.developer.music-kit: Apple Music integration
com.apple.security.application-groups: Shared data
Info.plist Keys
NSGroupActivitiesUsageDescription: SharePlay permission
NSAppleMusicUsageDescription: Music access permission
NSCameraUsageDescription: Video chat (future)
NSMicrophoneUsageDescription: Voice chat (future)
Building for Production
Update in Xcode project settings or Package.swift
2. Add Signing & Capabilities
- Enable App Groups
- Enable Group Activities
- Enable MusicKit
3. Test SharePlay
SharePlay requires:
- Two physical devices (simulator not supported)
- FaceTime call active
- Same Apple ID signed in
4. Submit to App Store
- Configure App Store Connect
- Add screenshots for all platforms
- Complete metadata and privacy information
API Integration Notes
Apple TV+ (Future)
- Currently uses placeholder URLs
- Integrate with Apple TV+ API when available
- Requires content licensing agreements
Apple Music
- Uses MusicKit framework
- Requires user authorization
- Respects subscription status
SharePlay
- Automatic session management
- AVPlaybackCoordinator for media sync
- Custom message passing for game state
Future Enhancements
- Advanced Chess Features: En passant, castling, pawn promotion
- Video Chat: Integrate AVKit for video calls
- Cloud Sync: iCloud integration for cross-device state
- Notifications: Push notifications for room invites
- Analytics: Track usage and engagement
- Social Features: Friend lists, achievements, leaderboards
- More Games: Checkers, Trivia, Backgammon
- Content Discovery: Browse Apple TV+ and Music catalog
Troubleshooting
SharePlay Not Working
- Verify entitlements are configured
- Check FaceTime call is active
- Ensure devices are on same network
- Test with physical devices (not simulator)
Music Authorization Failed
- Check Info.plist has NSAppleMusicUsageDescription
- Verify Apple Music subscription is active
- Request authorization before playing
Build Errors
- Clean build folder: Product > Clean Build Folder
- Update dependencies: File > Packages > Update to Latest Package Versions
- Verify Xcode version is 15.0+
Contributing
This is a reference implementation. For production use:
- Add proper error handling
- Implement real backend services
- Add comprehensive logging
- Enhance UI/UX for each platform
- Add accessibility features
- Implement proper state persistence
License
Copyright © 2025 - All Rights Reserved