Skip to content

Conversation

@anthonybiasi
Copy link

Summary

Fixes crash on macOS when presenting sheets due to missing @EnvironmentObject propagation.

Problem

The macOS app (v1.4.4) crashes with EnvironmentObject.error() when presenting SwiftUI sheets. This is a known SwiftUI behavior difference where macOS requires explicit environment object passing while iOS sometimes propagates them automatically.

Solution

Added .environmentObject(viewModel) to 8 sheet and fullScreenCover presentations in ContentView.swift:

  • AppInfoView sheet (line ~191)
  • FingerprintView sheet (line ~202)
  • ImagePickerView fullScreenCover - iOS main context (line ~230)
  • MacImagePickerView sheet - macOS main context (line ~259)
  • ImagePreviewView sheet (line ~268)
  • ImagePickerView fullScreenCover - iOS sheet context (line ~833)
  • MacImagePickerView sheet - macOS sheet context (line ~854)
  • LocationChannelsSheet sheet (line ~1392)

Testing Performed

  • ✅ Built successfully on macOS
  • ✅ All sheet presentations open without crash
  • ✅ App Info sheet works
  • ✅ Location channels sheet works
  • ✅ People list sidebar works
  • ✅ No console warnings about missing environment objects
  • ✅ General app stability confirmed

Platforms Affected

  • Fixed: macOS
  • Tested On: macOS 26.1 (25B78) on Apple Silicon (M4)
  • Not Affected: iOS (existing behavior maintained)

Impact

  • Severity: HIGH (fixes app-breaking crashes)
  • Risk: LOW (additive changes only, no logic modifications)
  • Files Changed: 1 file, 8 line additions
  • Backwards Compatibility: Fully maintained

Before/After

Before: Opening any sheet/modal crashed the app with EnvironmentObject.error()
After: All sheets open correctly, full functionality restored on macOS

Anthony Biasi and others added 2 commits November 26, 2025 08:25
…ntations

Fixes crash on macOS when presenting sheets due to missing @EnvironmentObject.
Added .environmentObject(viewModel) to 8 sheet/fullScreenCover presentations.

Fixed presentations:
- AppInfoView sheet
- FingerprintView sheet
- ImagePickerView fullScreenCover (iOS, both contexts)
- MacImagePickerView sheet (macOS, both contexts)
- ImagePreviewView sheet
- LocationChannelsSheet sheet

Tested on macOS 26.1 (Apple Silicon M4).
All sheet presentations now open without crash.

Platform: macOS only
Impact: Resolves EnvironmentObject.error() crashes
@jackjackbits jackjackbits merged commit 6f1c879 into permissionlesstech:main Nov 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants