I wrote a unit test that used the XCTUnwrap function. This feature was added in XCode 11 and
"Asserts that an expression is not nil and returns the unwrapped value."
However, when I pushed my code to GitHub, the build broke with the following error.
error: use of unresolved identifier 'XCTUnwrap'
To fix this I updated my
.github/workflows/swift.yml file to include the XCode version. I found the solution from this GitHub Community Forum Post. You can specify the version in the
env using the
DEVELOPER_DIR tag. GitHub maintains a list of available XCode versions here.
Here is what my
swift.yml file looks like. This is for a swift package that is included in other iOS projects.
name: Swift on: push: branches: [ master ] pull_request: branches: [ master ] env: DEVELOPER_DIR: /Applications/Xcode_11.4.app/Contents/Developer jobs: build: runs-on: macos-latest steps: - uses: actions/checkout@v2 - name: Build run: swift build -v - name: Run tests run: swift test -v