如何解决类型的值在 SwiftUI 中没有成员
在使用 ForEach 的 SwiftUI 中,模拟器上仅显示 item.purchase_order_number 数据。如果我使用 item.items.last_updated 或 item.invoices.created,它不会自动填充,并且我在 Xcode 中收到此消息:[Invoice] 类型的值没有成员“已创建”。
它不会检测到 item.purchase_order_number 以外的任何条目。请提出建议。
import Foundation
struct Model: Decodable,Hashable {
var purchase_order_number: String
var items: [Item]
var invoices: [Invoice]
}
struct Item: Identifiable,Decodable,Hashable {
var id: Int
var product_item_id: Int
var quantity: Int
var last_updated_user_entity_id: Int
var transient_identifier: String
var active_flag: Bool
var last_updated: String
}
struct Invoice: Identifiable,Hashable {
var id: Int
var invoice_number: Int
var received_status: Int
var created: String
var last_updated_user_entity_id: Int
var transient_identifier: String
var receipts: [Receipts]
}
struct Receipts: Identifiable,Hashable {
var id: Int
var product_item_id: Int
var received_quantity: Int
var created: String
var last_updated_user_entity_id: Int
var transient_identifier: String
var sent_date: String
var active_flag: Bool
var last_updated: String
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。