Open jbromberg opened 5 months ago
Ahhh you are building for the simulator. I wonder if that’s it.
Yea no matter what I change the device to in the SwiftUI preview window I get the same errors
Really appreciate the report!
There are checks in there, and they appear good enough for Linux builds. Need to investigate.
Could it be that according to SPM this is macOS, but according to the compiler it is not? That would be a wild problem that I would totally believe.
I have confirmed that in this specific situation, the package dependency conditionals think this is macOS 😵💫.
Hmmm. So does that mean using @available
wouldn't work?
@available
is a good thought, but that is a runtime construct, not a compile-time thing. We need to prevent the compiler from seeing this code. (This distinction is a little confusing. I wrote about it a bit here: https://www.chimehq.com/blog/swift-and-old-sdks)
Step one, I managed to create a reasonably minimal example and included it in a bug report: FB13551706
So I investigated a few different possible fixes for this, and I wasn't able to find one that didn't have drawbacks.
I think the most readable solution, given that this only affects SwiftUI previews on iOS is to maintain a branch with the features not supportable by iOS explicitly removed.
SwiftUI Previews fail to load when using this package due to many compile errors related to the ProcessEnv and FSEventsWrapper dependencies. Here's a build log showing the errors:
Build for Previews code-edit_2024-01-18T10-57-02.txt