My dictionary is always nil, would like to understand why this is happening. My code:
var dic = [NSDate : MCACalendar]?()
dic?[currentDate!] = calendar
It seems [NSDate : MCACalendar]?()
fails and returns nil
. You probably want to use:
var dic = [NSDate : MCACalendar]?([:])
or
var dic: [NSDate : MCACalendar]? = [:]
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments