0
値のない辞書の辞書を宣言したい。値のない辞書の辞書を宣言する
通常、私はオプションを宣言しなければならないと思います。
しかし、私は設定方法を理解できません。
どうすればいいですか?
class AppDelegate: UIResponder, UIApplicationDelegate {
let p1: [String: String] = ["name" : "John","age" : "30"] // make p1
let p2: [String: String] = ["name" : "Picker","age" : "32"] // make p2
let p3: [String: String] = ["name" : "Tom","age" : "28"] // make p3
var members: [String?: [String?:String?]] // it shows error
///Type 'String?' does not conform to protocol 'Hashable'
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
{
members = ["key1":p1,"key2":p2,"key3": p3]
// I want to put variables here.
}
varメンバー:[String:[String:String]] = [:] ' –
オプションキーを辞書キーとして使用することはできませんので、すべてのオプションを削除しても問題ありません –