So I'm trying to make a List in SwiftUI like this:
struct DetailsView: View {
var piis = [IDPiece]()
var body: some View {
List(piis, id: \.identifier) { pii in
Text( pii.label )
}
}
}
where IDPiece looks like:
struct IDPiece: Equatable {
init() {}
init(claim: Claim) {
self.document = claim.document
self.identifier = claim.identifier
self.claimUID = claim.claimUID
self.label = claim.label
}
var document: DocumentType = .na
var identifier: String = ""
var claimUID: String = ""
var label: String?
}
But I keep receiving the following error on the line where I initialize the list:
Type '_' has no member 'identifier'
It doesn't seem to be parsing the type of object contains in my piis list. Anyone know why that may be?