제라스의 iOS 공부/Swift 문법

[Swift 문법] 딕셔너리 타입 초기화 방법

Xerath(제라스) 2023. 8. 17. 14:21
728x90
반응형

Swift에는 여러 Collection을 제공해주는데 그 중 하나가 Dictionary 타입이다.

이 딕셔너리 타입을 초기화를 할 때는 어떻게 하는지 정리해두고자 한다.

let phoneCount:[String:Int] = [:]

let phoneCount:[String:Int] = [String:Int]()

let phoneCount = [String:Int]()

let phoneCount = Dictionary<String, Int>()
728x90
반응형