Hello swift community
I am trying to decompose my big iOS app into small packages. In the process of it, I found some problems when trying to test SPM with iOS specific (UIKit) stuff in it.
I have made one small SPM Package library and added it as a local package into my project. I see that now an additional scheme is available in my Xcode project.
I can successfully build via Xcode UI and also with command line:
xcodebuild -scheme MyLittleViewUtil build -destination "platform=iOS Simulator,name=iPhone 8,OS=latest"
xcodebuild -scheme MyLittleViewUtil test -destination "platform=iOS Simulator,name=iPhone 8,OS=latest"
Questions:
- What is the correct command to run something similar to above but from SPM command line?
For building this works:
swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios14.0-simulator"
But for testing it fails:
swift test -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios14.0-simulator"
error: module 'XCTest' was created for incompatible target x86_64-apple-macos10.15:
- My little library uses UIKit and some UIViews. I have heard that for now SPM tests cannot run on an host application. Is there anything I can do to test the UI from SPM only? Is Xcode13/Swift/SPM functionality enhanced in anyway that alleviate my situation? What are my alternatives?
Any help is appreciated.