This PR is practically identical to https://github.com/devicekit/DeviceKit/pull/342 and solves the same issue - when DeviceKit is used as framework dependency, Mac targets importing that framework fail to build for Xcode Previews.
This is not a build issue in Debug / Release configuration, it is only reproducible with Xcode Previews, as Xcode Previews seem to not be understanding platform filters (Link binary with libraries / Filters -> iOS, platformFilter = ios).
The only difference of this PR from #342 is that instead of if os() conditionals this PR uses #if canImport() statements, which should be more resilient, however it's obviously up to maintainers to select which approach is better suited for DeviceKit.
This PR is practically identical to https://github.com/devicekit/DeviceKit/pull/342 and solves the same issue - when DeviceKit is used as framework dependency, Mac targets importing that framework fail to build for Xcode Previews.
This is not a build issue in Debug / Release configuration, it is only reproducible with Xcode Previews, as Xcode Previews seem to not be understanding platform filters (Link binary with libraries / Filters -> iOS, platformFilter = ios).
The only difference of this PR from #342 is that instead of if os() conditionals this PR uses #if canImport() statements, which should be more resilient, however it's obviously up to maintainers to select which approach is better suited for DeviceKit.