김경록의 앱 개발 여정

[Swift] Tuist를 통한 SPM 라이브러리 의존성 관리하기 본문

TIL

[Swift] Tuist를 통한 SPM 라이브러리 의존성 관리하기

Kim Roks 2025. 1. 9. 18:41

import ProjectDescription

let dependencies = Dependencies(
  swiftPackageManager: .init(
    [
      .remote(url: "https://github.com/SnapKit/SnapKit.git", requirement: .upToNextMinor(from: "5.0.1")),
      .remote(url: "https://github.com/Swinject/Swinject.git", requirement: .exact("2.8.0")),
      .remote(url: "https://github.com/ReactiveX/RxSwift.git", requirement: .upToNextMajor(from: "6.0.0")),
      .remote(url: "https://github.com/ReactorKit/ReactorKit.git", requirement: .upToNextMajor(from: "3.0.0"))
    ]
  ),
  platforms: [.iOS]
)
  1. 기존의 tuist로 작성된 프로젝트 파일 디렉토리 접근
  2. 터미널에 tuist edit을 통해 Manifests -> Tuist -> OrihectDesctiptionHelpers -> Dependecies 에서 라이브러리 추가 및 수정
    (Finder를 통해 찾아 들어가도 가능)
  3. project.swift수정
  4. 터미널에서 tuist fetch 입력
  5. 터미널에서 tuist generator 입력
  6. The file is located at “yourProject”. Do you want to keep the Xcode version, or use the version on disk?
    이라는 문구에 Version on Disk 선택하면 변경사항 확인 가능

주의사항 

Keep the Xcode version: 현재 Xcode에 로드된 프로젝트 파일을 유지.

만약 이미 Xcode 내에서 변경사항을 가했다면, 이 옵션을 선택하여 그 변경사항을 유지할 수 있습니다.

use the version on disk: 디스크에 저장된 버전으로 교체. 이는 다른 개발자가 수행한 변경사항을 적용하거나, 소스 코드 관리를 통해 최신 코드를 가져온 경우 유용할 수 있습니다.