Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode canvas for SwiftUI always fail #296

Closed
Zeta611 opened this issue Apr 29, 2020 · 1 comment · Fixed by #297
Closed

Xcode canvas for SwiftUI always fail #296

Zeta611 opened this issue Apr 29, 2020 · 1 comment · Fixed by #297

Comments

@Zeta611
Copy link
Contributor

Zeta611 commented Apr 29, 2020

Version

077c096

Environment

macOS 10.15.4 + Xcode 11.4.1

Description

Xcode's canvas won't preview SwiftUI view when adding SwiftCheck to the test target dependency.

Steps To Reproduce

From Xcode File > Swift Packages > Add Package Dependency add Swift Check. Select test target.
Go to ContentView.swift default template file.

Expected Result

Preview should build and show "Hello, World!"

Actual Result

Xcode fails to build preview.
However, Simulator runs fine.

Additional information

When I click 'diagnostics', it shows the following:

'disabled' is only available in iOS 10.0 or newer

----------------------------------------

SchemeBuildError: Failed to build the scheme "test"

Compile Swift source files:
warning: Could not read serialized diagnostics file: Invalid File: Invalid diagnostics signature (in target 'TSCBasic' from project 'swift-tools-support-core')
warning: Could not read serialized diagnostics file: Invalid File: Invalid diagnostics signature (in target 'TSCBasic' from project 'swift-tools-support-core')
warning: Could not read serialized diagnostics file: Invalid File: Invalid diagnostics signature (in target 'TSCBasic' from project 'swift-tools-support-core')
warning: Could not read serialized diagnostics file: Invalid File: Invalid diagnostics signature (in target 'TSCBasic' from project 'swift-tools-support-core')


Compile /Users/jay/Library/Developer/Xcode/DerivedData/test-fuoxsdzrmdjcfdbltcfeaqoxrdxv/SourcePackages/checkouts/swift-tools-support-core/Sources/TSCBasic/OSLog.swift:
/Users/jay/Library/Developer/Xcode/DerivedData/test-fuoxsdzrmdjcfdbltcfeaqoxrdxv/SourcePackages/checkouts/swift-tools-support-core/Sources/TSCBasic/OSLog.swift:52:35: error: 'disabled' is only available in iOS 10.0 or newer
            return OSLog(os.OSLog.disabled)
                                  ^
/Users/jay/Library/Developer/Xcode/DerivedData/test-fuoxsdzrmdjcfdbltcfeaqoxrdxv/SourcePackages/checkouts/swift-tools-support-core/Sources/TSCBasic/OSLog.swift:52:35: note: add 'if #available' version check
            return OSLog(os.OSLog.disabled)
                                  ^
...
@Zeta611
Copy link
Contributor Author

Zeta611 commented Apr 29, 2020

This happened because Xcode resolved the test packages of SwiftCheck as well. This is updated with Xcode 11.4 + tools version 5.2. I forked the repo and changed the version to 5.2, and voila, it worked like charm. I'm opening a pull request for this fix.

svdo pushed a commit to Zwaai-app/zwaai-ios that referenced this issue Jun 22, 2020
Fix in SwiftCheck is not yet released as of today:
typelift/SwiftCheck#296
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant