I'm testing my app built with Xcode 15.1 on 3 devices:
- iPhone 14 Pro (iOS 17.2) - no problem with both debug and release builds
- iPhone 6S (iOS 15.7.9) - no problem with both debug and release builds
- iPhone 5S (iOS 12.5.7) - no problem with debug build but immediate crash on the splash screen when running release build.
The message is:
dyld: Library not loaded: /System/Library/Frameworks/SwiftUI.framework/SwiftUI Referenced from: /var/containers/Bundle/Application/MyApp.app/MyApp Reason: image not found
Googled about this error and it seems to be an old and known issue: "Apps containing SwiftUI inside a Swift package might not run on versions of iOS earlier than iOS 13. (53706729)."
Adding -weak_framework SwiftUI
to Other Linker Flags
fixed my issue.
However I'm curious why this old issue reappeared in the most recent Xcode 15 while I haven't such problems with Xcode 14 and 13.