I am beginning to learn swift
by following the iBook-The Swift Programming Language
on Swift provided by Apple. The book says to create an empty dictionary one should use [:]
same as while declaring array as []
:
I declared an empty array as follows :
let emptyArr = [] // or String[]()
But on declaring empty dictionary, I get syntax error:
let emptyDict = [:]
How do I declare an empty dictionary?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…