我需要帮助将此转换为快速。有任何想法吗?
NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:pushMessage, @"alert", @"increment", @"badge", nil];
答案 0 :(得分:1)
您可以在swift中初始化该字典,如下所示,最后得到一个等效的NSDictionary:
let data : NSDictionary = [ "alert" : pushMessage, "badge" : "increment" ]
有关详细信息,请参阅Apple's section on collection types within the Swift programming language documentation。
希望有所帮助!