์˜์กด์„ฑ ๊ด€๋ฆฌ๋„๊ตฌ ์ฃผ์š” ๊ธฐ๋Šฅ

  • Module
    • ์˜์กด์„ฑ์„ ์•Œ๋ ค์ฃผ๋Š” ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋กœ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋“ค์ด ๊ด€๋ฆฌ๋จ
  • Manifest
    • ๋ช…์„ธ์„œ ์—ญํ• 
  • Lock
    • ์„ค์น˜๋œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ๋ฒ„์ „๊ณผ ์˜์กด ๊ตฌ์กฐ๋ฅผ ๋ณด์—ฌ์คŒ
    • ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์„ค์น˜๋œ ๋‹ค์Œ ์ ํž˜
  • Repository
    • ๋ชจ๋“ˆ์ด ์ €์žฅ๋œ ๊ณต๊ฐ„, ๋ณดํ†ต github
  • Dependency Constraint
    • ๋ชจ๋“ˆ์˜ ํ—ˆ์šฉ๋˜๋Š” ๋ฒ„์ „, ๋ณดํ†ต Manifest ํŒŒ์ผ์— ์ ํ˜€์ง
  • Resolution Rule
  • ๋ชจ๋“ˆ์˜ ์ ํ•ฉํ•œ ๋ฒ„์ „์„ ์„ค์น˜ํ•ด ์คŒ
๋„๊ตฌ์„ธํŒ…๋นŒ๋“œ์†๋„
-------------------------------
CocoaPods๊ฐ„ํŽธํ•จ๋Š๋ฆผ
Carthage๋ณต์žกํ•จ๋น ๋ฆ„
Swift Package Manager๊ฐ„ํŽธํ•จ๋Š๋ฆผ

Cocoapods

  • ๊ฐ„ํŽธํ•จ
  • ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์น˜ ํ›„ ์ถ”๊ฐ€ ์ž‘์—…์ด ์—†๋‹ค.
  • Xcode ์„ธํŒ…์„ ์ž๋™ํ™”ํ•ด์„œ ์‹œ๊ฐ„์„ ์ ˆ์•ฝํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋ชฉ๋ก์ด ์ค‘์•™ํ™”๋˜์–ด ์žˆ๋‹ค.
  • ๋””๋ฒ„๊น…์ด ํŽธ๋ฆฌํ•˜๋‹ค. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋‚ด๋ถ€ ์ฝ”๋“œ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

pod install

Podfile.lock์— ๋ฆฌ์ŠคํŠธ๋œ ํŒŸ๋“ค์— ๋Œ€ํ•ด์„  ์ง€์ •๋œ ๋ฒ„์ „๋งŒ ๋‹ค์šด (์ƒˆ๋กœ์šด ๋ฒ„์ „ ์ฒดํฌํ•˜์ง€ ์•Š์Œ)
Podfile.lock์— ๋ฆฌ์ŠคํŠธ๋˜์ง€ ์•Š์€ ํŒŸ๋“ค์€ Podfile์— ๋ช…์‹œ๋œ ๋ฒ„์ „ ์กฐ๊ฑด์œผ๋กœ ๊ฒ€์ƒ‰ํ•˜์—ฌ ๋‹ค์šด๋กœ๋“œ

์ฆ‰, ๋™๋ฃŒ์™€ ๋ฒ„์ „์„ ๋งž์ถ”๊ธฐ ์œ„ํ•ด์„œ๋Š” ํ•ด๋‹น ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค.

pod update

Podfile.lock์„ ํ™•์ธํ•˜์ง€ ์•Š๊ณ  ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์—…๋ฐ์ดํŠธ

์ž‘๋™ ์›๋ฆฌ

Podfile

๋ช…์„ธ์„œ

source "custom repo"
source "custom repo2"

platform: ios, '11.0' # ํ”Œ๋žซํผ ์ง€์ •
inhibit_all_warnings! # library์—์„œ ๋ฐœ์ƒํ•˜๋Š” warning ๋ฌด์‹œ

target 'Example' do
    use_frameworks! # Static Library ๋Œ€์‹ , Framework๋ฅผ ์‚ฌ์šฉ

    pod 'SnapKit', '~>5.0.0' # ๋ฒ„์ „์ง€์ •: ์ตœ์†Œ 5.0.0 ์ด์ƒ 6.0.0 ๋ฏธ๋งŒ ์‚ฌ์šฉ

    target 'ExampleTests' do  # ์ค‘์ฒฉ๋จ
        inherit! :search_paths
        pod 'Quick'
        pod 'Nimble'
    end
end
  • pod 'SnapKit': ์ตœ์‹  ๋ฒ„์ „ ์˜๋ฏธ
  • pod 'SnapKit', '5.0.1': ๊ตฌ์ฒด์  ๋ฒ„์ „
  • > 0.1: ์ดˆ๊ณผ
  • >= 0.1: ์ด์ƒ
  • < 0.1: ๋ฏธ๋งŒ
  • <= 0.1: ์ดํ•˜
  • ~> 0.1.2: 0.1.2 ์ด์ƒ, 0.2 ๋ฏธ๋งŒ
  • ~> 0.1: 0.1 ์ด์ƒ, 1.0 ๋ฏธ๋งŒ

ํŠน์ • ๋ธŒ๋žœ์น˜๋ฅผ ์ง€์ •ํ•ด์„œ pod์— ์ถ”๊ฐ€ํ• ์ˆ˜๋„ ์žˆ๋‹ค.

๋กœ์ปฌ (์ง์ ‘ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๊ฐœ๋ฐœํ•  ๋•Œ ์‚ฌ์šฉ)
pod 'Alamofire', :path => '~/Documents/Alamofire'

๋งˆ์Šคํ„ฐ branch ๊ธฐ์ค€
pod 'Alamofire', :git => '[address].git'

ํŠน์ • branch ๊ธฐ์ค€
pod 'Alamofire', :git => '[address].git', :branch => 'dev'

ํƒœ๊ทธ ๊ธฐ์ค€
pod 'Alamofire', :git => '[address].git', :tag => '3.1.1'

์ปค๋ฐ‹ ๊ธฐ์ค€
pod 'Alamofire', :git => '[address].git', :commit => '0f506fe12'

Carthage

  • ์ž์œจ์„ฑ
  • ์ค‘์•™ํ™”๋œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋ชฉ๋ก ์—†์Œ
  • dependency๋ฅผ binaryy framework๋กœ ๋นŒ๋“œํ•ด ์คŒ
  • ํ”„๋กœ์ ํŠธ ์„ธํŒ…์€ ์‚ฌ์šฉ์ž ๋ชซ
  • ๋นŒ๋“œ ์†๋„ ๋‹จ์ถ•์„ ์œ„ํ•ด ์ฃผ๋กœ ์‚ฌ์šฉ

Swift Package Manager

  • Apple์ด ๋งŒ๋“  first party depdendency manager
  • ๊ฐ€์žฅ ํŽธ๋ฆฌํ•จ
  • ๋””๋ฒ„๊น… ํŽธ๋ฆฌ (์›๋ณธ ์†Œ์Šค ๋ณผ ์ˆ˜ ์žˆ์Œ)
  • ํ•˜์ง€๋งŒ ์ง€์›์•ˆํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋“ค์ด ๋งŽ์Œ
    • major ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ๋Œ€๋ถ€๋ถ„ ์ง€์›

Reference