iOS SPM local package 추가하기 RangeSeekSlider

2022. 2. 14. 00:23iOS

the manifest is missing a Swift tools version specification; consider prepending to the manifest'// swift-tools-version:5.5.0'
to specify the current Swift toolchain version as the lowest Swift version supported by the project; if such a specification already exists, consider moving it to the top of the manifest, or prepending it with '//' to help Swift Package Manager find it in

오래된 라이브러리 중에서 SPM을 지원하지 않는  경우 위와 같은 에러 메시지가 뜬다.

issue에 SPM support해달라고 등록되어 있지만 아직 merge되지 않은 경우 등

SPM 이슈

이런 경우에 pods을 이용하여 해결하거나 다음과 같이 local package를 추가하여 해결할 수 있다.

 

이 글에서는 RangeSeekSlider 라이브러리를 예로 들어서 설명하겠다.

zip파일로 다운 받은 후 압축을 해제하고, 프로젝트 - 패키지 디팬던시에 가서 패키지 추가를 눌러준다.

왼쪽 하단의 Add local 버튼을 눌러 다운 받은 패키지를 추가한다.

그러면 위와 같이 프로젝트에 패키지 폴더와 함께 추가된다.

Package.swift 파일을 위와 같이 수정해준다. 다른 라이브러리의 Package.swift 파일을 참고하여 작성한다.
// swift-tools-version:5.5 라인이 있어야 SPM을 이용할 수 있다.

프로젝트 타겟 - General - Frameworks, Libraries, and Embedded Contnet 섹션에서 추가를 누른다.

Package를 찾아서 Add해주면 된다.

그러면 다른 라이브러리와 같이 import [package명]으로 사용 가능하다.

 

참고: https://tanaschita.com/20210417-how-to-add-local-swift-package-to-ios-project/

'iOS' 카테고리의 다른 글

인프콘 - FLO 커피챗  (0) 2023.08.16
video asset writer 관련 참조 링크들  (0) 2023.02.03