0
0
Swiftprogramming~5 mins

Project structure and Swift Package Manager basics - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main purpose of the Swift Package Manager (SPM)?
Swift Package Manager helps you manage and share Swift code by handling dependencies, building, and distributing packages easily.
Click to reveal answer
beginner
Name the default file that defines a Swift package's configuration.
The file is called Package.swift. It describes the package's name, products, dependencies, and targets.
Click to reveal answer
intermediate
What are 'targets' in a Swift package?
Targets are the basic building blocks of a package. Each target can be a module or a test suite, containing source files to compile.
Click to reveal answer
beginner
Where should source files be placed in a Swift package project structure?
Source files go inside the Sources/ directory, organized by target name. Test files go inside Tests/ similarly.
Click to reveal answer
intermediate
How do you add an external dependency to a Swift package?
You add the dependency URL and version in the dependencies array inside Package.swift. Then you specify which targets use it.
Click to reveal answer
Which directory contains the main source code in a Swift package?
ASources/
BTests/
CBuild/
DDocs/
What file do you edit to define your Swift package's dependencies?
AREADME.md
BInfo.plist
Cmain.swift
DPackage.swift
In Swift Package Manager, what is a 'target'?
AA test report
BA folder for documentation
CA group of source files compiled together
DA build configuration
Where do you put test files in a Swift package?
ADocs/
BTests/
CBuild/
DSources/
Which command initializes a new Swift package?
Aswift package init
Bswift build
Cswift run
Dswift test
Explain the basic folder structure of a Swift package project and the role of each folder.
Think about where your code and tests live and how the package knows about them.
You got /3 concepts.
    Describe how you add and use an external dependency in a Swift package.
    Focus on editing Package.swift and how targets relate to dependencies.
    You got /3 concepts.