Greeting all
I've created a customer list but I'm struggling to split it into sections based on my model. Could anyone point me in the right direction on how to solve.
Kind Regards
View
struct simoView: View {
var body: some View {
let simos: [Simo] = normalSimList.fullPriceSim
List(simos, id: \.id) { simo in
Section {
VStack(alignment: .leading, spacing: 5) {
Text(simo.title)
.fontWeight(.semibold)
.lineLimit(2)
.minimumScaleFactor(0.5)
HStack {
Text(simo.price)
.font(.subheadline)
.foregroundStyle(.secondary)
Spacer()
Text(simo.sku)
.font(.subheadline)
.foregroundStyle(.secondary)
Spacer()
Text(simo.rev)
.font(.subheadline)
.foregroundStyle(.secondary)
}
}
}
}
}
}
Model:
struct Simo: Identifiable {
let id = UUID()
let imageName = "simcard.fill"
let title: String
let price: String
let sku: String
let rev: String
}
struct addLineSimList {
static let addLineSim = [
Simo(title: "100GB", price: "£10.00", sku: "120753", rev: "£52.80"),
Simo(title: "100GB Roam 51", price: "£17.00", sku: "...", rev: "..."),
Simo(title: "150GB", price: "£13.00", sku: "120754", rev: "£68.63"),
Simo(title: "Unlimited Max", price: "£20.00", sku: "120755", rev: "£105.60"),
]
}
struct normalSimList {
static let fullPriceSim = [
Simo(title: "50GB", price: "£21.00", sku: "121079", rev: "£140.80"),
Simo(title: "80GB Ent", price: "£29.00", sku: "121089", rev: "£158.26"),
Simo(title: "150GB", price: "£25.00", sku: "121081", rev: "£161.92"),
Simo(title: "150GB Roam 51", price: "£32.00", sku: "120420", rev: "£168.96"),
Simo(title: "Unlimited Max", price: "£33.00", sku: "120169", rev: "£203.32"),
Simo(title: "Unlimited Max Roam 51", price: "£40.00", sku: "120385", rev: "£281.60"),
Simo(title: "Unlimited Max Roam 83", price: "£43.00", sku: "120395", rev: "£295.68")
]
}