로딩
요청 처리 중입니다...

[Swift] Generic(1)

 [Swift] Generic(1)

Swift 는 안전하고, 매우 고성능의 언어이며, Generic 역시 Swift만이 갖는 강력한 도구이다. 제네릭의 애플 문서 정의를 살펴 보면 제네릭은 타입에 의존하지 않고, 범용성이 있는 코드를 작성할 수 있게한다.

즉 중복을 피하고 코드를 유연하게 작성을 할 수 있다. Generic code enables you to write flexible, reusable functions and types that can work with any type, subject to requirements that you define 여기서 핵심은 types that can work with any type이라는 것이다.

Swift’s Array and Dictionary types are both generic collections. You can create an array that holds Int values, or an array that holds String values, or i...

원문 링크 : [Swift] Generic(1)