티스토리 뷰
Cocoapod 라이브러리 만들어보기 포스팅을 쓰면서, SPM으로도 이 라이브러리를 import하는 방법을 찾아보고 싶었는데, 기록합니다.
⚠️ 이 포스팅은 저의 의식의 흐름(?) 순서대로 구성되어있으므로 깔끔한 순서를 보고 싶으신 분은
Supporting Swift Package Manager in your Pod in 5 simple steps 이 글을 참조하세요!_! ⚠️
[1] 나의 라이브러리 폴더에 들어가서 밑의 명령어를 칩니다.
swift package init
그러면 이렇게 Package.swift 등등의 파일을 만들어줍니다.
이 변경사항을 커밋해줍니다.
[2] 나의 라이브러리를 올려둔 깃헙에 들어가서 새로운 릴리즈 버전을 만들어줍니다.
0.1.0 에서 0.1.1로 Latest Release가 바뀌었고, 가장 최근 커밋에 이 태그가 달렸습니다.
이렇게만 해도 import가 가능해지지만,
SPM 구조를 보면 애플 공식문서에 나와있는 구조랑 다른 것을 볼 수 있습니다.
Sources 안에 SpeechBubbleView가 들어가지 않고 밖으로 나와있습니다..!!
게다가 Sources안에는 SpeechBubbleView라는 것이 자동으로 생겨져있고,
눌러보면, 이런 임시용(?) 구조체 입니다...!!
[3] Sources안에 임의로 생긴 폴더와 파일을 지워주고, SpeechBubbleView를 Sources안으로 옮깁니다.
⚠️ 그리고 코코아팟 챙기는 것도 까먹으면 안됩니다 ⚠️
폴더 구조 바뀐 것을 Podspec파일에도 반영해줘야합니다...!!!!!
SpeechBubbleView.podspec에 들어가서
이렇게 되어있던 것을
s.source_files = 'SpeechBubbleView/Classes**/*'
이렇게 바꿔줍니다.
s.source_files = 'Sources/SpeechBubbleView/Classes**/*'
그리고 버전도
이렇게 되어있던 것을
s.version = '0.1.0'
이렇게 미리 바꿔줍니다.
s.version = '0.1.2'
이렇게 커밋해준 후, publish release 해줍니다..!!
다시 예제 프로젝트에 import해보면
잘들어가고 패키지 구성도 잘되어있습니다..!!
⚠️ 그리고 코코아팟 챙기는 것도 까먹으면 안됩니다 ⚠️
pod의 기본 버전을 바꿨으니까
pod trunk push
이 명령어로 코코아팟에 새로운 버전을 업데이트 시켜줍니다.
그래야지 이 라이브러리를 코코아팟으로 새로 설치하거나 혹은 pod update하는 분들이
새로운 버전(0.1.2)를 다운받을 수 있게 되실 것입니당...!!!
Reference
[1] 애플
https://developer.apple.com/documentation/xcode/creating_a_swift_package_with_xcode
Creating a Swift Package with Xcode | Apple Developer Documentation
Article Creating a Swift Package with Xcode Create a Swift package to promote modularity and code reuse across your apps. OverviewAs you develop your app, you may discover parts of your code are reusable in your other apps. Refactoring this code into a Swi
developer.apple.com
https://github.com/apple/swift-package-manager/blob/master/Documentation/Usage.md
apple/swift-package-manager
The Package Manager for the Swift Programming Language - apple/swift-package-manager
github.com
[2] 블로그
Supporting Swift Package Manager in your Pod in 5 simple steps
Don’t get me wrong. I love Cocoapods. But it’s time to move on, for the times they are a-changin’
medium.com
https://sebastiandobrincu.com/blog/how-to-update-your-cocoapods-library-version
How to Update your CocoaPods Library Version — Sebastian Dobrincu
If you are anything like me, you often forget how to publish a new version of your Cocoapods library. Although it's a really easy process, you can easily forget it if you don't do it in a while. So here's a quick cheat sheet for doing that: 1. Update the
sebastiandobrincu.com
'🍏 > iOS' 카테고리의 다른 글
[Cocoapod] Cocoapod 명령어 모음 (0) | 2020.01.07 |
---|---|
[SPM] 처음부터 Swift Package Manager를 만들어보자 (2) | 2019.12.23 |
[Shadow] Shadow의 Amazing한 속성 (자신의 색깔이 clear이면 자식뷰에게 shadow가 적용됨) (1) | 2019.11.16 |
[Xcode Preview] UIKit에서 Xcode Preview 사용하기 (0) | 2019.11.13 |
[UIView] UIView에 관한 질문들 정리 (0) | 2019.10.27 |
- Total
- Today
- Yesterday
- Django FCM
- flutter deep link
- 플러터 얼럿
- Sketch 누끼
- Flutter getter setter
- METAL
- 구글 Geocoding API
- drf custom error
- 장고 Custom Management Command
- ribs
- Python Type Hint
- cocoapod
- PencilKit
- flutter dynamic link
- 플러터 싱글톤
- Flutter Spacer
- github actions
- Dart Factory
- Django Firebase Cloud Messaging
- ipad multitasking
- Django Heroku Scheduler
- DRF APIException
- Watch App for iOS App vs Watch App
- Flutter Text Gradient
- flutter 앱 출시
- flutter build mode
- 장고 URL querystring
- SerializerMethodField
- Flutter 로딩
- Flutter Clipboard
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |