Swift Package Manager
SPM
target 폴더로 이동
터미널에서 swift package init
입력. 몇 가지 파일이 생긴다
핵심이 되는 Package.swift
파일 설정
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "JNomaKit",
platforms: [
.iOS(.v13)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "JNomaKit",
targets: ["JNomaKit"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "JNomaKit",
dependencies: []),
.testTarget(
name: "JNomaKitTests",
dependencies: ["JNomaKit"]),
]
)
소스코드 작성
Git 작업
이미 SPM이 적용된 프로젝트를 clone해온 경우 File -> Packages -> Update를 해줘야 한다
Xcode File 탭 -> add Packages -> repo url 입력
File -> Packages -> Update to Latest Package Versions