79709537

Date: 2025-07-21 19:21:42
Score: 0.5
Natty:
Report link

Also fell into this scenario recently. The setup was:

The classes were wrapped in ‘@available’, but similar to you, this didn’t solve the import issue - making the app crash instantly. I had to move my code that interacts with SwiftData into its own target.

I found a solution which was:

In the Framework, I used ‘#if canImport(X)’, and in the Application, I added ‘SwiftData’ as an optional link.

Now runs on older versions of iOS that don’t support SwiftData.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Declan Land