私はswiftで目的のCコードを変換しています。辞書スウィフトから辞書を取得
辞書に辞書があるサーバーからデータを取得しています。 キー値の文字列を取得していますが、辞書を取得できません。
データ例:
data = {
caption = hello;
image = {
a = "https://www.google.com/1024x1024";
b = "https://www.google.com/640x640";
c = "https://www.google.com/480x480";
d = "https://www.google.com/";
};
};
私はキャプション
let dataDict = (mainDict[data] as? Dictionary<String,AnyObject>)!
Obj.caption=String(dataDict["caption"]!) //getting hello
Obj.imageDictionary = (dataDict["image"] as? Dictionary<String,String>)! //getting 0 key value pairs
は、私はこの辞書を格納したい、画像辞書を取得する方法を提案してください
var imageDictionary = Dictionary<String, String>()
としてimageDictionaryを初期化取得することができますimageDictionaryオブジェクトの
ご意見をいただければ幸いです! ありがとうございます!
あなたは(単に '印刷用dataDictを[コンソールログを追加することができます"image"]) 'のようなものです。 –
あなたのスペースは...芸術的です。 – Alexander