๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ“ ๊ธฐ๋ก/TIL

[TIL] 20231124

Initalization (์ดˆ๊ธฐํ™”)

์ดˆ๊ธฐํ™”๋Š” class, struct, enum์˜ ์ธ์Šคํ„ด์Šค์˜ ์‚ฌ์šฉ์„ ์œ„ํ•ด ์ค€๋น„ํ•˜๋Š” ๊ณผ์ •

์ƒˆ๋กœ์šด ์ธ์Šคํ„ด์Šค๋ฅผ ์‚ฌ์šฉํ•  ์ค€๋น„๋ฅผ ํ•˜๊ธฐ ์œ„ํ•ด ์ธ์Šคํ„ด์Šค์˜ ์ €์žฅ ํ”„๋กœํผํ‹ฐ์˜ ์ดˆ๊ธฐ๊ฐ’์„ ์„ค์ •ํ•˜๋Š” ๋“ฑ์˜ ์ผ์„ ํ•œ๋‹ค.

์ด๋‹ˆ์…œ๋ผ์ด์ € init

ํ”„๋กœํผํ‹ฐ ์ดˆ๊ธฐ๊ฐ’์„ ์ง€์ •ํ•˜๊ธฐ ์–ด๋ ค์šด ๊ฒฝ์šฐ์—๋Š” ์ด๋‹ˆ์…œ๋ผ์ด์ € init์„ ํ†ตํ•ด ์ธ์Šคํ„ด์Šค๊ฐ€ ๊ฐ€์ ธ์•ผ ํ•  ์ดˆ๊ธฐ๊ฐ’์„ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ๋‹ค.

์ด๋‹ˆ์…œ๋ผ์ด์ €๋Š” ์ƒˆ๋กœ์šด ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋Š” ํŠน๋ณ„ํ•œ ๋ฉ”์„œ๋“œ๊ฐ€ ๋˜๋Š” ๊ฒƒ

์ฃผ์š” ์—ญํ• ์€ ์ƒˆ ์ธ์Šคํ„ด์Šค๊ฐ€ ์ฒ˜์Œ ์‚ฌ์šฉ๋˜๊ธฐ ์ „์— ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ดˆ๊ธฐํ™”๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•˜์ง€ ์•Š์Œ

initializer์˜ ์ข…๋ฅ˜

ํด๋ž˜์Šค์˜ ๋ชจ๋“  ํ”„๋กœํผํ‹ฐ๋Š” ์ดˆ๊ธฐํ™” ๊ณผ์ •์—์„œ ๋ฐ˜๋“œ์‹œ ์ดˆ๊ธฐ๊ฐ’์ด ํ• ๋‹น๋˜์–ด์•ผ ํ•จ

์ƒ์†๋ฐ›์€ ํด๋ž˜์Šค๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ, ์ƒ์œ„ ํด๋ž˜์Šค์˜ ํ”„๋กœํผํ‹ฐ๋„ ๋ชจ๋‘ ์ดˆ๊ธฐํ™” ๋˜์–ด์•ผ ํ•จ

Swift์—์„œ๋Š” ๋ชจ๋“  ํด๋ž˜์Šค์˜ init์ด ๋ณด์žฅ๋  ์ˆ˜ ์žˆ๋„๋ก ๋‘ ๊ฐ€์ง€ ์ดˆ๊ธฐํ™” ๋ฉ”์„œ๋“œ๋ฅผ ์ œ๊ณต (designated, convenience)

Designated Initializer (์ง€์ • ์ดˆ๊ธฐํ™”)

  • ํด๋ž˜์Šค์— ์ง€์ •๋œ ๋ชจ๋“  ํ”„๋กœํผํ‹ฐ๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜๊ณ  ์ƒ์†๋ฐ›์€ ํด๋ž˜์Šค๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ, ์Šˆํผ ํด๋ž˜์Šค์˜ init์„ ํ˜ธ์ถœ
  • ํด๋ž˜์Šค๋Š” ์ตœ์†Œ ํ•˜๋‚˜ ์ด์ƒ์˜ designated initializer๋ฅผ ๊ฐ–๋Š”๋‹ค

Convenience Initializer

  • ํด๋ž˜์Šค์— ์ง€์›๋˜๋Š” ๋ณด์กฐ์ ์ธ initializer
  • ์˜๋ฌด๋กœ ๊ผญ ์ƒ์„ฑ๋˜์–ด์•ผ ํ•˜๋Š” ๊ฒƒ ์•„๋‹˜
  • ํ•„์š”ํ•œ ๊ฒฝ์šฐ ์ƒ์„ฑ ๊ฐ€๋Šฅ
  • Designated Initalizer ์ƒ์„ฑ ํ›„ ์‚ฌ์šฉ ๊ฐ€๋Šฅ
class PersonC {
    var name: String
    var age: Int
    var nickName: String?
    
    init(name: String, age: Int) {
        self.name = name
        self.age = age
    }

    convenience init(name: String, age: Int, nickName: String) {
        self.init(name: name, age: age)
        self.nickName = nickName
    }
}

Failable Initializer (์‹คํŒจ๊ฐ€๋Šฅํ•œ ์ด๋‹ˆ์…œ๋ผ์ด์ €)

์ด๋‹ˆ์…œ๋ผ์ด์ € ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ „๋‹ฌ๋˜๋Š” ์ดˆ๊ธฐ๊ฐ’์ด ์ž˜๋ชป๋œ ๊ฒฝ์šฐ ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ์— ์‹คํŒจํ•  ์ˆ˜ ์žˆ์Œ
์‹คํŒจ ๊ฐ€๋Šฅ์„ฑ์„ ๋‚ดํฌํ•œ ์ด๋‹ˆ์…œ๋ผ์ด์ €๋ฅผ ์‹คํŒจ๊ฐ€๋Šฅํ•œ ์ด๋‹ˆ์…œ๋ผ์ด์ €๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค.
์‹คํŒจ ๊ฐ€๋Šฅํ•œ ์ด๋‹ˆ์…œ๋ผ์ด์ €๋Š” ์‹คํŒจํ–ˆ์„ ๋•Œ nil์„ ๋ฐ˜ํ™˜ํ•ด์ฃผ๋ฏ€๋กœ ๋ฐ˜ํ™˜ ํƒ€์ž…์ด ์˜ต์…”๋„๋กœ ์ง€์ •๋œ๋‹ค. init? ํ‚ค์›Œ๋“œ๋ฅผ ์ด์šฉํ•ด ๊ตฌํ˜„

 

class Dog {
    var name: String
    var age: Int
    
    init(name: String, age: Int) {
        self.name = name
        self.age = age
    }
}

class Puppy: Dog {
    var owner: String
    var address: String
    
    init?(owner: String, address: String) {
        guard owner.count < 5 else {
            return nil
        }
        self.owner = owner
        self.address = address
        super.init(name: "๋ฉ๋ฉ์ด", age: 1)
    }
}

 

์œ„์™€ ๊ฐ™์ด ํŠน์ • ์กฐ๊ฑด์— ๋ถ€ํ•ฉํ•˜์ง€ ์•Š์œผ๋ฉด nil์„ ๋ฐ˜ํ™˜ํ•˜๊ณ , ํด๋ž˜์Šค ์ธ์Šคํ„ด์Šค์˜ ์ƒ์„ฑ์„ ๋ง‰์„ ์ˆ˜ ์žˆ๋‹ค.

๋””์ด๋‹ˆ์…œ๋ผ์ด์ € deinit

๋””์ด๋‹ˆ์…œ๋ผ์ด์ €๋Š” ์ด๋‹ˆ์…œ๋ผ์ด์ €์™€ ๋ฐ˜๋Œ€ ์—ญํ• 
deinit์€ ํด๋ž˜์Šค์˜ ์ธ์Šคํ„ด์Šค๊ฐ€ ๋ฉ”๋ชจ๋ฆฌ์—์„œ ํ•ด์ œ๋˜๋Š” ์‹œ์ ์— ํ˜ธ์ถœ๋œ๋‹ค.
์ด๋Š” ๋ฉ”๋ชจ๋ฆฌ์—์„œ ํ•ด์ œ๋˜๋Š” ์‹œ์ ์— ์ž๋™์œผ๋กœ ํ˜ธ์ถœ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์ง์ ‘ ํ˜ธ์ถœํ•  ์ˆ˜ ์—†์Œ
์ธ์Šคํ„ด์Šค๊ฐ€ ๋ฉ”๋ชจ๋ฆฌ์—์„œ ํ•ด์ œ๋˜๋Š” ์‹œ์ ์€ ARC(Automatic Reference Counting) ์˜ ๊ทœ์น™์— ๋”ฐ๋ผ ๊ฒฐ์ •๋จ
โš ๏ธ ๋””์ด๋‹ˆ์…œ๋ผ์ด์ €๋Š” ํด๋ž˜์Šค์˜ ์ธ์Šคํ„ด์Šค์—๋งŒ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ์ง€๋‹ ์ˆ˜ ์—†๋‹ค!

 

class PersonE {
    var name: String
    var pet: Puppy?
    var child: PersonC
    
    init(name: String, child: PersonC) {
        self.name = name
        self.child = child
    }
    
    // ์ธ์Šคํ„ด์Šค๊ฐ€ ๋ฉ”๋ชจ๋ฆฌ์—์„œ ํ•ด์ œ๋˜๋Š” ์‹œ์ ์— ์ž๋™ ํ˜ธ์ถœ
    deinit {
        if let petName = pet?.name {
            print("\(name)๊ฐ€ \(child.name)์—๊ฒŒ \(petName)๋ฅผ ์ธ๋„ํ•ฉ๋‹ˆ๋‹ค")
            self.pet?.owner = child
        }
    }
}

var donald: PersonE? = PersonE(name: "donald", child: jenny)
donald?.pet = happy
donald = nil // donald ์ธ์Šคํ„ด์Šค๊ฐ€ ๋”์ด์ƒ ํ•„์š”์—†์œผ๋ฏ€๋กœ ๋ฉ”๋ชจ๋ฆฌ์—์„œ ํ•ด์ œ๋ฉ๋‹ˆ๋‹ค
// Prints: donald๊ฐ€ jenny์—๊ฒŒ happy๋ฅผ ์ธ๋„ํ•ฉ๋‹ˆ๋‹ค

Initializer Delegation

<๊ณต์‹ ๋ฌธ์„œ ๋ฒˆ์—ญ>

์ด๋‹ˆ์…œ๋ผ์ด์ €๋Š” ๋‹ค๋ฅธ ์ดˆ๊ธฐํ™” ์ด๋‹ˆ์…œ๋ผ์ด์ €๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์ธ์Šคํ„ด์Šค ์ดˆ๊ธฐํ™”์˜ ์ผ๋ถ€๋ฅผ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Initializer Delegation๋ฅผ ํ†ตํ•ด ์—ฌ๋Ÿฌ ์ด๋‹ˆ์…œ๋ผ์ด์ € ๊ฐ„์˜ ์ค‘๋ณต๋œ ์ฝ”๋“œ๋ฅผ ํ”ผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Value Type์—์„œ์˜ Initializer Delegation

๊ฐ’ ํƒ€์ž…์—์„œ๋Š” ์ƒ์†์˜ ๊ฐœ๋…์ด ์—†๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ„๋‹จํ•จ

initializer๋ฅผ ์ •์˜ํ•  ๋•Œ self.init()์„ ์ด์šฉํ•ด์„œ ๋‹ค๋ฅธ initializer๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์ค‘๋ณต๋œ ์ฝ”๋“œ๋ฅผ ํ”ผํ•  ์ˆ˜ ์žˆ์Œ

 

struct Point {
    var x: Double
    var y: Double
    
    init(x: Double, y: Double) {
        self.x = x
        self.y = y
    }
    
    init(value: Double) {
        self.x = value
        self.y = value
    }
}

var zero: Point = Point(x: 0.0, y: 0.0)
zero = Point(value: 0.0)

 

Initializer Delegation์„ ์ด์šฉํ•ด ์ค‘๋ณต๋œ ์ฝ”๋“œ๋ฅผ ์‚ญ์ œํ•  ์ˆ˜ ์žˆ์Œ (์œ„์™€ ๊ฐ™์€ ๊ธฐ๋Šฅ)

struct Point {
    var x: Double
    var y: Double
    
    init(x: Double, y: Double) {
        self.x = x
        self.y = y
    }
    
    init(value: Double) {
        self.init(x: value, y: value)
    }
}

var zero: Point = Point(value: 0.0)

Reference Type์—์„œ์˜ Initializer Delegation

Swift๋Š” class์˜ initializer ๊ฐ„์˜ delegation์— ๋Œ€ํ•ด ์„ธ ๊ฐ€์ง€ ๊ทœ์น™์„ ์ •ํ•ด์คŒ

1. designated Initializer๋Š” ๋ฐ˜๋“œ์‹œ superclass์˜ designated initalizer๋ฅผ ํ˜ธ์ถœํ•ด์•ผ ํ•œ๋‹ค.(delegation up)

2. convenience initializer๋Š” ๊ฐ™์€ ํด๋ž˜์Šค์˜ ๋‹ค๋ฅธ ์ด๋‹ˆ์…œ๋ผ์ด์ €๋ฅผ ํ˜ธ์ถœํ•ด์•ผ ํ•œ๋‹ค. (delegation across)

3. convenience initializer๋Š” 2๋ฒˆ ๋ฃฐ์„ ์ง€์ผœ์„œ ๋‹ค๋ฅธ ์ด๋‹ˆ์…œ๋ผ์ด์ €๋ฅผ ํ˜ธ์ถœํ•˜๋”๋ผ๋„ ๊ฒฐ๊ตญ์—” designated initializer๋ฅผ ํ˜ธ์ถœํ•ด์•ผ ํ•œ๋‹ค. (delegation across)

์ถœ์ฒ˜: The Swift Programming Language ๋ฌธ์„œ

์˜ˆ์ œ ์ฝ”๋“œ

 

class BaseTableViewCell: UITableViewCell {

    // MARK: init
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setCommonAttributes()
        setStyle()
        setLayout()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    /// ๊ธฐ๋ณธ attributes ์„ค์ • ๋ฉ”์„œ๋“œ 
    private func setCommonAttributes() {
        selectionStyle = .none
    }
    
    func setStyle() { }
    
    func setLayout() { }
}
final class SettingListTableViewCell: BaseTableViewCell {
    
    // MARK: Properties
    private let titleLabel = UILabel()

    // MARK: UI
    override func setStyle() {
        titleLabel.do {
            $0.font = .pretendardM(16)
            $0.textColor = .grayBlack
        }
    }
    
    override func setLayout() {
        contentView.addSubview(titleLabel)
        
        titleLabel.snp.makeConstraints {
            $0.top.leading.bottom.equalToSuperview().inset(16)
        }
    }
       
    // MARK: Custom Methods
    func setData(title: String) {
        titleLabel.text = title
    }
}

 

Swift ์ดˆ๊ธฐํ™” ๊ทœ์น™์— ๋”ฐ๋ผ SettingListTableViewCell์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑํ•  ๋•Œ ์ž๋™์œผ๋กœ ์Šˆํผ ํด๋ž˜์Šค(BaseTableViewCell)์˜ designated initializer๊ฐ€ ๋จผ์ € ํ˜ธ์ถœ๋˜๊ธฐ ๋•Œ๋ฌธ์— ๋ช…์‹œ์ ์œผ๋กœ init์„ ํ˜ธ์ถœํ•˜์ง€ ์•Š์•„๋„ ๊ณตํ†ต ์†์„ฑ์ด ์„ค์ •๋˜๊ณ , ์Šคํƒ€์ผ๋ง ๋ฐ ๋ ˆ์ด์•„์›ƒ ๋ฉ”์„œ๋“œ๊ฐ€ ํ˜ธ์ถœ๋˜์–ด ์ดˆ๊ธฐํ™” ๊ณผ์ •์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ˆ˜ํ–‰๋œ๋‹ค. Swift์—์„œ ์ด ๊ณผ์ •์„ ์ž๋™์œผ๋กœ ์ฒ˜๋ฆฌํ•˜์—ฌ ์ดˆ๊ธฐํ™”๊ฐ€ ํ•˜์œ„ ํด๋ž˜์Šค๋ถ€ํ„ฐ ์‹œ์ž‘๋˜์–ด ์ƒ์† ์ฒด์ธ์„ ๋”ฐ๋ผ ์˜ฌ๋ผ๊ฐ€๋„๋ก ๋ณด์žฅํ•จ

 

์ฐธ๊ณ  ๋ฌธ์„œ: The Swift Programming Language - Initialization

 

Tuist

Tuist๋ž€?

Tuist๋Š” Apple ํ”Œ๋žซํผ์šฉ ๋Œ€๊ทœ๋ชจ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ตฌ์ถ•์˜ ๋ณต์žก์„ฑ์„ ํ•ด๊ฒฐํ•˜๋„๋ก ์„ค๊ณ„๋œ ๋ช…๋ น์ค„ ์ธํ„ฐํŽ˜์ด์Šค(CLI)์ž…๋‹ˆ๋‹ค. (๊ณต์‹๋ฌธ์„œ ๋ฒˆ์—ญ)

์ฆ‰, Tuist๋Š” Xcode ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ๊ณผ ์œ ์ง€ ๋ฐ ๊ด€๋ฆฌ๋ฅผ ํŽธ๋ฆฌํ•˜๊ฒŒ ํ•˜๋Š” ๊ฒƒ์„ ๋„์™€์ฃผ๋Š” CLI ๋„๊ตฌ

 

Xcode ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ ๋ฐ ๊ด€๋ฆฌ ๋„๊ตฌ๋ž€?

.xcodeproj๋ฅผ ๊นƒํ—ˆ๋ธŒ์— ์˜ฌ๋ ค๋†“๊ณ  ํ˜‘์—…์„ ํ•  ๋•Œ, ํŒŒ์ผ์„ ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜ ์ˆ˜์ •ํ•˜๊ฒŒ ๋˜๋ฉด ๋‹ค๋ฅธ ์‚ฌ๋žŒ๊ณผ .pbxprojํŒŒ์ผ์˜ ๋‚ด์šฉ์ด ๋‹ฌ๋ผ์ง€๊ธฐ ๋•Œ๋ฌธ์— git conflict๊ฐ€ ๋ฐœ์ƒ. ์ด๋ฅผ ์˜ˆ๋ฐฉํ•˜๊ธฐ ์œ„ํ•ด ์ฝ”๋“œ์ ์œผ๋กœ ํ”„๋กœ์ ํŠธ๋ฅผ ๊ด€๋ฆฌ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ๊ฒƒ์ด ํ”„๋กœ์ ํŠธ ๊ด€๋ฆฌ ํˆด. ๋˜ํ•œ, ๋ชจ๋“ˆํ™”๋ฅผ ํ•  ๋•Œ ๋ชจ๋“ˆ ๊ตฌ์กฐ๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ๋ฐ ํŽธ๋ฆฌํ•˜๋‹ค๋Š” ์ด์ ์ด ์žˆ์Œ. ๋Œ€ํ‘œ์ ์œผ๋กœ XcodeGen, Tuist ๋“ฑ์ด ์žˆ๋‹ค!

 

Why Tuist?

Tuist์™€ XcodeGen์˜ ๊ฐ€์žฅ ํฐ ์ฐจ์ด์ ์€ XcodeGen์€ .yml ๋˜๋Š” json ํŒŒ์ผ์„ ํ†ตํ•ด ํ”„๋กœ์ ํŠธ๋ฅผ ๊ด€๋ฆฌํ•˜์ง€๋งŒ Tuist๋Š” swift ํŒŒ์ผ๋กœ ํ”„๋กœ์ ํŠธ๋ฅผ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค.

Tuist๋ฅผ ๋„์ž…ํ•ด์•ผ ํ•˜๋Š” ์ด์œ 

Tuist๋ฅผ ๋„์ž…ํ•˜๋ฉด ๊ตฌ์ฒด์ ์œผ๋กœ ๋ญ๊ฐ€ ์ข‹์„๊นŒ???

์นด์นด์˜ค๋ฑ…ํฌ iOS ํ”„๋กœ์ ํŠธ์˜ ๋ชจ๋“ˆํ™” ์—ฌ์ •: Tuist๋ฅผ ํ™œ์šฉํ•œ ๋ชจ๋“ˆ ์•„ํ‚คํ…์ฒ˜ ์„ค๊ณ„ ์‚ฌ๋ก€ (if kakao ์„ธ์…˜)์„ ์ฐธ๊ณ ํ–ˆ๋‹ค!

 

https://if.kakao.com/2022/session/88

 

if(kakao)dev2022

ํ•จ๊ป˜ ๋‚˜์•„๊ฐ€๋Š” ๋” ๋‚˜์€ ์„ธ์ƒ

if.kakao.com

 

1. ํ•„์š”ํ•œ ์ฝ”๋“œ์™€ ๋ชจ๋“ˆ๋งŒ ์ฆ๋ถ„ ๋นŒ๋“œ ํ•  ์ˆ˜ ์žˆ์–ด ๋น ๋ฅธ ๋นŒ๋“œ๊ฐ€ ๊ฐ€๋Šฅํ•ด์ง

๋ชจ๋“ˆ ๋‹จ์œ„๋กœ ๋ฐ๋ชจ ์•ฑ์„ ๋งŒ๋“ค์–ด์„œ ํ•„์š”ํ•œ ๊ธฐ๋Šฅ๋งŒ ํ…Œ์ŠคํŠธ ๊ฐ€๋Šฅ

์ฆ๋ถ„ ๋นŒ๋“œ๊ฐ€ ๊ฐ€๋Šฅํ•ด์ง€๋ฉด ํ…Œ์ŠคํŠธ ์‹œ๊ฐ„ ๋˜ํ•œ ๋นจ๋ผ์ง

 

2. ๋ถˆํ•„์š”ํ•œ ์˜์กด์„ฑ ์ œ๊ฑฐ ๊ฐ€๋Šฅ

๋ถˆํ•„์š”ํ•œ ์˜์กด์„ฑ์„ ์ œ๊ฑฐํ•จ์œผ๋กœ์จ ์ „์ฒด์ ์ธ ์„ฑ๋Šฅ์„ ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ์Œ

 

3. ์˜์กด์„ฑ ๊ทธ๋ž˜ํ”„ ์ƒ์„ฑ ๊ฐ€๋Šฅ

ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ ๊ฐ€์‹œํ™” ๊ฐ€๋Šฅํ•ด์ ธ ๊ฑฐ์‹œ์ ์ธ ๊ด€์ ์—์„œ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ ๋ฐ ๊ด€๋ฆฌ๊ฐ€๋Šฅ

 

๋ชจ๋“ˆ ๋ถ„๋ฆฌ๊ฐ€ ์–ด๋ ค์šด ์ด์œ ?

1. ํ”„๋กœ์ ํŠธ, ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์ˆ˜๋™์œผ๋กœ ์ƒ์„ฑํ•˜๊ณ  ๊ด€๋ฆฌํ•˜๋Š” ๊ณผ์ •์—์„œ ์‹ค์ˆ˜๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Œ

(ํ•œ ํ”„๋กœ์ ํŠธ์— ๋™์ /์ •์  ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด ์ด๋ฅผ ๋ชจ๋‘ ์ˆ˜๋™์œผ๋กœ ๊ด€๋ฆฌํ–ˆ์„ ๋•Œ ๋งŒ์•ฝ ๋™์  ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์‹ค์ˆ˜๋กœ embed ํ•˜์ง€ ์•Š์•˜๋‹ค? ๋Ÿฐํƒ€์ž„ ์—๋Ÿฌ ๋ฐœ์ƒํ•จ)

 

2. SwiftPM ์ œ์•ฝ์‚ฌํ•ญ

Configuration์€ debug, release๋งŒ ์ œ๊ณตํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์—ฌ๋Ÿฌ ํ™˜๊ฒฝ(develop, test, production ๋“ฑ)์˜ configuration ์„ค์ •์€ ์–ด๋ ค์›€

 

์œ„์˜ ์–ด๋ ค์šด ์ ๋“ค์„ ํ•ด๊ฒฐํ•ด์ค„ ์ˆ˜ ์žˆ๋Š” ๋„๊ตฌ๊ฐ€ Tuist

ํ”„๋กœ์ ํŠธ์— ์ ์šฉํ•ด๋ณด๊ณ  ์ ์šฉ๊ธฐ๋ž‘ ์žฅ์ , ๋‹จ์  ์ •๋ฆฌํ•ด์„œ ๋”ฐ๋กœ ๊ธ€์„ ์จ๋ณด๊ฒ ์Œ!!!

 

[์ฐธ๊ณ  ์ž๋ฃŒ]

https://baegteun.tistory.com/2

https://docs.next.tuist.io/documentation/tuist/

https://if.kakao.com/2022/session/88

'๐Ÿ“ ๊ธฐ๋ก > TIL' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[TIL] 20231129  (1) 2023.11.29
[TIL] 20231128  (3) 2023.11.29
[TIL] 20231123  (1) 2023.11.23
[TIL] 20231122  (0) 2023.11.22
[TIL] 20231121  (0) 2023.11.21