목록nested type (1)
HIT해

Nested Type이란?sturct나 enum 안에 다른 타입을 넣는 걸 뜻한다. 예시struct MyPet { enum Kind { case cat case dog var value : String { // 자기 자신을 switch구문으로 정의할 수 있다. switch self { case .cat : return "고양이" case .dog : return "강아지" } } } // Kind enum} value를 중첩타입이라고 부른다 struct MyPet { enum Kind { cas..
Swift/Swift 기초문법
2024. 8. 19. 22:03