我正在这样的字典中创建和打印值
let answersToSubmit = SubmitAnswerModel() //main model
let realm = try! Realm()
let savedExamResponse = realm.object(ofType: SavedExamResponse.self, forPrimaryKey: id)
answersToSubmit.uniqid = savedExamResponse?.uniqueId
var answerListToSubmit = [QuestionAnswersToSubmit]()
for item in (savedExamResponse?.questionAnswerList)! {
let answerToSubmit = QuestionAnswersToSubmit()
answerToSubmit.qid = item.questionId
answerToSubmit.value.append(item.selectedOption)
answerListToSubmit.append(answerToSubmit)
}
answersToSubmit.answers = answerListToSubmit
print("length %s ",answersToSubmit.answers.count)//this is printing 100
print("answers to submit %s",answersToSubmit)//this is printing only the first part
输出如下
length %s 100
answers to submit %s SubmitAnswerModel {
uniqid = test-5cb2f6a2d81034.66536499;
//the rest of the object needs to printed here, isn't it
}
所以我不太确定我是否已经附加了数组并将其放入字典中。任何帮助都将不胜感激。谢谢
最佳答案
如果您想要更全面的日志输出,请改用dump()
函数:
dump(answersToSubmit)
它会把更多的信息打印到控制台上。
关于ios - Swift字典包含值,但未在调试器控制台上打印,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55674208/