devicekit / DeviceKit

DeviceKit is a value-type replacement of UIDevice.
MIT License
4.39k stars 425 forks source link

Fix missing os warning in Swift Playgrounds #369

Closed kudit closed 5 months ago

kudit commented 9 months ago

In Swift Playgrounds (which doesn't yet support Swift 5.9), there is a warning that the OS is not supported since it doesn't know about xrOS (visionOS): "Unknown operating system for build configuration 'os'". I've re-worked the conditional compiles to look for the module UIScreen which is more appropriate rather than the OS tests and added a Swift version compiler check for the case that isn't module dependent. The last area is a bit redundant but I wasn't sure how to structure the statements without the redundancy since you can't do #if os(visionOS) without doing #if swift(>=5.9) first and separately.

kudit commented 8 months ago

Added check for building on macOS (without catalyst) so it will not generate errors. The Swift < 5.9 checks aren't necessary with the new version of Swift Playgrounds, but it probably would be good to keep for a bit in case someone is using an older version.

Zandor300 commented 7 months ago

@kudit Your PR contains a lot of other changes. In its current state it won't be merged.