iOS

Swift Package Manager

Swift Package Manager, Package.swift, dependencies, versioning, local packages

16 câu hỏi phỏng vấn·
Mid-Level
1

What is the main manifest file required to define a Swift Package?

Câu trả lời

The Package.swift file is the mandatory manifest for any Swift Package. It contains package metadata, dependencies, targets, and products. Without this file at the package root, Xcode cannot recognize the structure as a valid package.

2

How to define an executable target in SPM?

Câu trả lời

An executable target produces an application or command-line tool. It differs from a library target by producing a standalone executable binary. Executable targets require a valid entry point (main.swift file or @main) to compile correctly. SPM uses .executableTarget() in Package.swift to define this target type.

3

What is the difference between a target and a product in SPM?

Câu trả lời

A target is a compilation unit containing source code, while a product is the consumable artifact generated from one or more targets. A product exposes targets to the outside world and defines how they are distributed. For example, the same target can be exposed as a static or dynamic library depending on the product. This separation provides flexibility in code distribution while centralizing compilation logic.

4

How to declare a remote dependency in SPM?

5

What is the role of local dependencies in SPM?

+13 câu hỏi phỏng vấn

Nắm vững iOS cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí