Swift. Extension
Extensions 타입에 있는 기능을 확장하고 싶을 때 사용한다. 기존 자료형 확장의 한 방법이다. 기존 자료형에 계산 속성, 메소드, 서브스크립트 등을 추가할 수 있다. Swift에서 Extensions는 연산 인스턴스 프로퍼티 및 연산 타입 프로퍼티 추가 인스턴스 메소드 및 타입 메소드 정의 새로운 이니셜라이저 제공 서브스크립트 정의 새 중첩 타입 정의 및 사용 기존 타입이 프로토콜을 준수하도록 한다 이런 기능들을 할 수 있습니다. 프로토콜의 요구사항의 구현하거나 적합한 타입이 활용할 수 있는 기능을 추가하기 위해 프로토콜을 확장할 수도 있다. 자세한 사항은 Protocol Extensions 참조. Extension은 타입에 새로운 기능을 추가할 수는 있지만 기존 기능(함수)를 override 할..
2019. 4. 25. 11:13