I am having difficulties translating an Objective C "method" to swift. Any help would be greatly appreciated. Thank you.
Objective C
NSDictionary *fields = @{@"msg": @"connect", @"version": version, @"support": support};
My attempt in Swift (wrong)
let fields:Dictionary = {"msg": "connect", "version": version, "support": support}
Swift uses square brackets for Array and Dictionary:
let fields: Dictionary = ["msg": "connect", "version": version, "support": support]
it's just the format of the content between the brackets which determines what it is
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.