2018년 10월 30일 화요일

xcode 버젼 스위칭


현재 xcode 버젼 보기

xcode-select --print-path



스위칭하기

sudo xcode-select --switch /Applications/Xcode9.app/Contents/Developer

2018년 10월 23일 화요일

Fork 을 Original repo 와 동기화 방법

명령어 :

git pull UrlOfOriginalRepo YourCloneRepo


example)

AD01224046:~ user$ git pull https://git-dev.linecorp.com/buffett/client-ios.git develop


2018년 10월 8일 월요일

클래스이름 가져오기



let typeFromClass = String(describing: MyView.self)
        let myView = UINib(nibName: typeFromClass, bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! UIView
        let typeFromInstance = String(describing: type(of: myView))
        
        print(typeFromClass) // "MyView"

        print(typeFromInstance) // "MyView"




MyView
MyView

생성자에 파라미터 전송하기


2. instantiate from class with parameters

//  MyView

class MyView: UIView {

    var color: UIColor
    
    required init(frame: CGRect, color: UIColor) {
        self.color = color
        super.init(frame: frame)
        
        // do anything after instantiated
        self.backgroundColor = self.color
    }
    
    required init?(coder aDecoder: NSCoder) { // never called
        fatalError("init(coder:) has not been implemented")
    }
    

}


//  ViewController.swift

override func viewDidLoad() {
        ...
        let myView = MyView(frame: CGRect(x: 0, y: 0, width: 100, height: 200), color: UIColor.cyan)
        ...
    }