twostraws / CodeScanner

A SwiftUI view that is able to scan barcodes, QR codes, and more, and send back what was found.
MIT License
987 stars 272 forks source link

Support Xcode preview for multi-platform project #143

Closed naan closed 1 month ago

naan commented 2 months ago

There's a bug in Xcode Preview when you have a multi-platform project. When you set build destination other than iOS on preview in such project, Xcode Preview tries to build depended packages that does not support those platforms even you set not build those packages in Xcode. (more detail about this bug, please read: https://stackoverflow.com/questions/71334194/swiftui-preview-incorrectly-tries-to-build-conditional-dependency-from-another-p and https://forums.swift.org/t/swiftpm-platform-conditional-target-dependancy-not-resolved-for-tvos/56767)

This PR adds #if os(iOS) ~ #endif to the source files so it passes build on mac target.

nathanfallet commented 1 month ago

This is a duplicate of #145, so I'm closing it to merge only one, but thanks anyway