Jiseob Kim

iOS Developer

Xcode - Carthage ์„ค์น˜

02 Jan 2019 » Xcode

Hello! 2019!

์ด์ „ํŽธ์—์„œ Carthage์ด๋ž€ ๋ฌด์—‡์ธ์ง€ ๊ทธ๋ฆฌ๊ณ  Cocoapods๋ณด๋‹ค ์žฅ์ ์€ ๋ฌด์—‡์ธ์ง€ ๊ธ€์„ ์จ๋ดค๋‹ค.

์ด์ „๊ธ€: [Carthage-์„œ๋ก ][https://jiseobkim.github.io/xcode/2018/12/26/Xcode-Cartage.html]

์˜ค๋Š˜๋„ ์งง๊ฒŒ! ์„ค์น˜๋ฒ•๋งŒ ์ ์–ด์•ผ๊ฒ ๋‹ค.


์š”์•ฝ

  • Homebrew ์„ค์น˜
  • Homebrew๋ฅผ ์ด์šฉํ•œ Carthage ์„ค์น˜
  • Carthage๋ฅผ ํ†ตํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์น˜( Alamofire ๋กœ ์„ค์น˜ ์˜ˆ์ •! )

Homebrew ์„ค์น˜

Homebrew๋ž€? ์‰ฝ๊ฒŒ ์ƒ๊ฐํ•˜์ž๋ฉด Cocoapods๊ณผ Carthage ์ฒ˜๋Ÿผ Package Manager ๊ฐ™์€ ๊ฒƒ์ด๋ผ ์ƒ๊ฐํ•˜๋ฉด ๋  ๊ฒƒ ๊ฐ™๋‹ค!

๊ทธ๋Ÿผ ์šฐ๋ฆฐ ๋ฌด์—‡์„ ํ• ๊ฒƒ์ธ๊ฐ€!

Carthage ๋ž€๊ฒƒ์„ ์„ค์น˜ํ•ด์•ผ ํ•˜๋ฏ€๋กœ ์ผ๋‹จ Homebrew๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ๋‹ค๋ฉด Pass

[Homebrew ์‚ฌ์ดํŠธ][https://brew.sh]๊ฐ€ ๊ณต์‹ ์‚ฌ์ดํŠธ๋‹ค. ์ž์„ธํžˆ ๋ณด๊ณ  ์‹ถ๋‹ค๋ฉด ํ•œ๋ฒˆ์ฏค ๋ณด๋ฉด ์ข‹์„๋“ฏํ•˜๋‹ค.

ํ•˜์ง€๋งŒ ๊ท€์ฐฎ๋‹ค๋ฉด, Terminal์„ ์‹คํ–‰ํ•˜๊ณ  ์•„๋ž˜ ๋ช…๋ น์–ด ์ž…๋ ฅ ํ›„ Enter!

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

๊ธฐ๋‹ค๋ฆฌ๋ฉด ๋.

Carthage ์„ค์น˜

[Carthage ๊ณต์‹ Github ์‚ฌ์ดํŠธ][https://github.com/Carthage/Carthage]์— ๊ต‰์žฅํžˆ ์ž์„ธํžˆ ๋‚˜์™€์žˆ๋‹ค.

Terminal์„ ์—ด๊ณ 

sudo chown -R $(whoami) /usr/local

์ž…๋ ฅํ•˜๊ณ 

chown ์€ ์†Œ์œ ์ž๋‚˜ ์†Œ์œ  ๊ทธ๋ฃน์„ ๋ณ€๊ฒฝํ•˜๋Š”๊ฒƒ์ด๊ณ ,

์˜ต์…˜ -R์€ ํ•ด๋‹น ๊ฒฝ๋กœ์™€ ํ•˜์œ„ ํŒŒ์ผ๋“ค ๋‹ค ๋ฐ”๊พผ๋‹ค๋Š”๊ฒƒ,

$(whoami)๋Š” ๋ง๊ทธ๋Œ€๋กœ ๋‚ด๊ฐ€ ๋ˆ„๊ตฐ์ง€๋ฅผ ๋‚˜ํƒ€๋‚ธ๋‹ค. ์•„๋งˆ Terminal ๋ช…๋ น์–ด ์ž…๋ ฅํ•˜๋Š” ๊ณณ ์•ž๋ถ€๋ถ„์ด๋ž‘ ๊ฐ™์„ ๊ฒƒ์ด๋‹ค!

๋’ค์— /usr/local ์„ค์ •ํ•˜๊ณ ์ž ํ•˜๋Š” ํŒŒ์ผ์ด๋‹ค.

์ฆ‰, /usr/local ๊ฒฝ๋กœ์™€ ๊ทธํ•˜์œ„ ๋ชฉ๋ก๋“ค์˜ ์†Œ์œ ์ž๋ฅผ ๋‚˜๋กœ ๋ฐ”๊ฟ”๋ผ! ๋ผ๋Š” ์˜๋ฏธ๋กœ ํ•ด์„ํ•  ์ˆ˜ ์žˆ๋‹ค.

์•ˆํ•ด๋„ ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์ง€๋งŒ iTerm2๋ฅผ ์“ฐ๋ฉด์„œ oh-my-zip์„ ์จ์„œ ๊ทธ๋Ÿฐ๊ฐ€? ์•ˆํ•ด์ฃผ๋ฉด ์•ˆ๋˜์—ˆ๋‹ค.


brew install carthage

์ž…๋ ฅํ•˜๋ฉด ๋.



Carthage๋ฅผ ํ†ตํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์น˜

Cocoapods ์‚ฌ์šฉ์ž๋ผ๋ฉด pod init์„ ํ•ด์„œ Podfile์„ ๋งŒ๋“ค์—ˆ์„ ๊ฒƒ์ด๋‹ค.

Podfile์€ ์„ค์น˜ํ•  ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ด๋ฆ„์„ ์ ๋Š”๊ณณ (์ถ”๊ฐ€ ์ •๋ณด๋„ ์ž…๋ ฅ๊ฐ€๋Šฅ)

Carthage ์‚ฌ์šฉ์ž๋ผ๋ฉด Cartfile์ด๋ž€๊ฒƒ์„ ๋งŒ๋“ค์–ด ์ค˜์•ผํ•œ๋‹ค. (Terminal ์ž…๋ ฅ)

vi Cartfile

ํŽธ์ง‘๊ธฐ๊ฐ€ ์—ด๋ฆฌ๋ฉด ์„ค์น˜ํ•˜๊ณ ์ž ํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ฃผ์†Œ ์ •๋ณด ๋ฐ ๋ฒ„์ ผ ์ •๋ณด๋ฅผ ์ ์œผ๋ฉด ๋œ๋‹ค. (Terminal ์ž…๋ ฅ)

github "Alamofire/Alamofire" ~> 4.7.2

-> 4.7.2 ๋Š” ์ƒ๋žต ๊ฐ€๋Šฅ

Podfile์— ๋น„ํ•ด Cartfile์€ ํŒŒ์ผ ๋‚ด์šฉ์ด ์‹ฌํ”Œํ•ด์„œ ์ข‹๋‹ค.


pod install ๊ฐ™์ด ์„ค์น˜๊ฐ€ ํ•„์š”ํ•˜๋‹ค. (Terminal ์ž…๋ ฅ)

carthage update


ํ•˜์ง€๋งŒ, ์‹ฌํ”Œํ•œ๋งŒํผ ํ›„์ž์—…์ด ์กฐ๊ธˆ ์žˆ๋‹คโ€ฆ

  1. Framework ์ˆ˜๋™ ์ถ”๊ฐ€
  2. Run Script ์ƒ์„ฑ
  3. shell script ์ž‘์„ฑ (์ด ํ‘œํ˜„์ด ๋งž๋Š”์ง€ ๋ชจ๋ฅด๊ฒ โ€ฆ..)
  4. Input Files์— ๋ฃจํŠธ ์ถ”๊ฐ€

์กธ๋ฆฌ๋ฏ€๋กœ ๋‚˜๋จธ์ง„ ๋‚ด์ผ ์ž‘์„ฑ.