Display Data example
After scanning the qrCode and obtain the response you can display the document data using the nameSpaces (key and value) like this example:
List {
ForEach(documents, id: \.docType) { d in
Section(header: Text(d.docType).font(.headline).lineLimit(1).minimumScaleFactor(0.3)) {
let nameSpaces = d.items
ForEach(Array(nameSpaces.keys), id: \.self) { ns in
Section(header: Text(ns)) {
ForEach(nameSpaces[ns]!, id: \.identifier) { item in
VStack(alignment: .leading) {
Text(String(localized:String.LocalizationValue(item.identifier))).fontWeight(.semibold).font(.footnote)
Text(item.stringValue).font(.footnote)
}.padding(.horizontal).padding(.bottom, 0)
}
}
}
}
}
}
In summary, this code creates a list of items grouped by document type and namespace, with each item displayed as a pair of text views in a vertical stack.