Swift

To create a new assignment in SQL, click into one of your courses, and then click Add assignment. Choose Swift from the drop-down list of available backend languages and set the the rest of your assignment's parameters (deadline, etc.). Once the assignment is created, a new folder will be created in the private GitHub/GitLab template repository for the course in which you are added this assignment. This folder will contain a standard Swift project structure.

Automated test-suite setup

If you would like to add tests that are automatically run by AssignmentOS against each student's solution to your assignment, you can add these as test classes in the iOS-AssignmentOS/iOS-AssignmentOSTests/ directory.

All unit test class filenames must end with Tests.swift and the test classes with filenames that end with HiddenTests.swift will not be visible to the student. All unit tests must use the XCTest testing framework.

If you want to add files that your hidden unit tests use and hence are also not visible to the student, the names of these files must begin with hidden (case-insensitive), e.g., hiddenFoo.json, hiddenFoo.csv, HiddenFoo.swift, etc.

Xcode version 14 must be used.

GitHub Action & GitLab CI/CD

AssignmentOS uses either GitHub Actions or GitLab CI/CD (depending on whether you use with GitHub or GitLab) to run automated unit tests. We provide the following GitHub Action & GitLab CI/CD file for Swift assignments. Note that this file is added dynamically to the repo of each student taking your assignment, so please do not include it in your template repo. This file also cannot be changed.

GitHub Action .yml file
GitLab CI/CD .yml file
name: Swift CI

on: push

jobs:

  build:
    runs-on: macos-12

    steps:
      - uses: actions/checkout@v3
      
      - uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: '14'

      - name: Build App
        run: cd iOS-AssignmentOS; xcodebuild -scheme iOS-AssignmentOS -destination "platform=iOS Simulator,name=iPhone 14,OS=latest"

      - name: Run tests
        run: cd iOS-AssignmentOS; xcodebuild clean -scheme iOS-AssignmentOS test -destination "platform=iOS Simulator,name=iPhone 14,OS=latest"

Coming soon!

Last updated