티스토리 뷰
🎅 간단 요약 🎄
[1] 깃헙에 레포지토리를 하나 만듭니다
[2] 소스트리에 클론해줍니다
[3] 해당 폴더에 들어가서 SPM을 만들어줍니다.
명렁어: swift package init
[4] 빌드가 잘 되는 지 확인합니다
명령어: swift build
[5] 테스트를 잘 돌리는 지 확인합니다
명령어: swift test
[6] 프로젝트를 만들어줍니다
명령어: swift package generate-xcodeproj
그리고 프로젝트가 잘 열리는 지 열어봅니다
명령어: xed .
(현재 폴더에 있는 프로젝트를 열어주는 명령어입니다)
이렇게 잘 열렸습니다.
예전에는 이렇게 구성되어있었는데,
이렇게 프로젝트가 생겼습니다.
[7] (옵션) dependencies를 설정해줍니다
현재 Package.swift에 가보면 dependencies가 이렇게 되어있는데,
만약에 SPM이 의존하는 라이브러리가 있다면 추가해줍니다
예를 들어 Alamofire라면 이렇게 해줍니다..!!
그리고 빌드가 잘되는 지 확인해보세요
(저는 일단 빼주겠겠습니다)
참고로 라이브러리를 추가하고 빼면 Package.resolved에 변경사항이 잡히는 것을 볼 수 있습니다.
여기 읽어 보면 Package.resolved 가 Podfile.lock과 비슷한 것 같습니다.
Resolving Versions (Package.resolved File)
The package manager records the result of dependency resolution in a Package.resolved file in the top-level of the package, and when this file is already present in the top-level, it is used when performing dependency resolution, rather than the package manager finding the latest eligible version of each package. Running swift package update updates all dependencies to the latest eligible versions and updates the Package.resolved file accordingly.Resolved versions will always be recorded by the package manager. Some users may choose to add the Package.resolved file to their package's .gitignore file. When this file is checked in, it allows a team to coordinate on what versions of the dependencies they should use. If this file is gitignored, each user will separately choose when to get new versions based on when they run the swift package update command, and new users will start with the latest eligible version of each dependency. Either way, for a package which is a dependency of other packages (e.g., a library package), that package's Package.resolved file will not have any effect on its client packages.
The swift package resolve command resolves the dependencies, taking into account the current version restrictions in the Package.swift manifest and Package.resolved resolved versions file, and issuing an error if the graph cannot be resolved. For packages which have previously resolved versions recorded in the Package.resolved file, the resolve command will resolve to those versions as long as they are still eligible. If the resolved version's file changes (e.g., because a teammate pushed a new version of the file) the next resolve command will update packages to match that file. After a successful resolve command, the checked out versions of all dependencies and the versions recorded in the resolved versions file will match. In most cases the resolve command will perform no changes unless the Package.swift manifest or Package.resolved file have changed.
Most SwiftPM commands will implicitly invoke the swift package resolve functionality before running, and will cancel with an error if dependencies cannot be resolved.
그리고 소스트리에서 여태까지 추가된 파일들을 커밋해주면 됩니다 :-)
아직 추가한 코드가 없으니까 깃헙에서 릴리즈 태그는 아직 달지 않겠습니다
커밍쑨~
(이 포스팅에서 코드추가하고 릴리즈 태그달고 SPM 적용한 부분이 나옵니다)
여기 글도 참고해보면 좋을 것 같아요~
https://www.raywenderlich.com/1993018-an-introduction-to-swift-package-manager
'🍏 > iOS' 카테고리의 다른 글
[Cocoapod] Unit Test를 돌렸는데, "One of the two will be used. Which one is undefined" 에러가 난다면 (1) | 2020.01.18 |
---|---|
[Cocoapod] Cocoapod 명령어 모음 (0) | 2020.01.07 |
[SPM] 나의 Cocoapod 라이브러리에 Swift Package Manager를 지원해보기 (0) | 2019.12.14 |
[Shadow] Shadow의 Amazing한 속성 (자신의 색깔이 clear이면 자식뷰에게 shadow가 적용됨) (1) | 2019.11.16 |
[Xcode Preview] UIKit에서 Xcode Preview 사용하기 (0) | 2019.11.13 |
- Total
- Today
- Yesterday
- Flutter Clipboard
- Flutter getter setter
- Python Type Hint
- DRF APIException
- PencilKit
- Django Firebase Cloud Messaging
- Django FCM
- Watch App for iOS App vs Watch App
- 플러터 얼럿
- flutter dynamic link
- github actions
- Flutter Text Gradient
- Flutter Spacer
- flutter build mode
- 플러터 싱글톤
- Django Heroku Scheduler
- METAL
- SerializerMethodField
- Flutter 로딩
- drf custom error
- 장고 Custom Management Command
- Sketch 누끼
- ribs
- flutter 앱 출시
- 장고 URL querystring
- Dart Factory
- ipad multitasking
- cocoapod
- flutter deep link
- 구글 Geocoding API
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |