I'm hitting an issue that the macOS target fails for SwiftUI previews. I understand this package doesn't support macOS, but it does create issues on macOS.
My situation is:
I have a Swift package that supports both iOS and macOS platforms.
Using the DeviceKit package on macOS target has no issues for normal build.
However, when using SwiftUI preview on macOS target, it always fails. The problem is somehow the SwiftUI preview builds the DeviceKit source code for macOS platform:
I think the fix is straightforward, we should wrap the whole generated code under:
#if os(iOS) || os(watchOS) || os(tvOS)
#endif
This problem happens on the latest Xcode (14.1 (14B47b))
Hi!
I'm hitting an issue that the macOS target fails for SwiftUI previews. I understand this package doesn't support macOS, but it does create issues on macOS.
My situation is: I have a Swift package that supports both iOS and macOS platforms.
The package uses
in
dependencies
.I set the target dependency for iOS platform only:
Using the DeviceKit package on macOS target has no issues for normal build.
However, when using SwiftUI preview on macOS target, it always fails. The problem is somehow the SwiftUI preview builds the DeviceKit source code for macOS platform:
I think the fix is straightforward, we should wrap the whole generated code under:
This problem happens on the latest Xcode (14.1 (14B47b))