我来自平线和网络发展,因此对迅速和快速发展来说仍然很新,我希望这样做的是通过数据模型,并通过某些数据进行表率。 你能够分享帮助我理解的任何信息都是有益的。 即便是我正确方向的一点也更好了。 这是我与以下方面合作:
@Environment(.modelContext) private var modelContext
@Query private var accounts: [LedgerAccounts]
@State var sheetEditAccount: Bool = false
ForEach(accounts) { account in
let accountNumberString = account.numberOfAccount
let accountNumberStringValue = String(accountNumberString.suffix(4))
HStack {
VStack {
Text("#" + accountNumberStringValue)
.font(.footnote)
.fontWeight(.thin)
.padding(.trailing, 20)
}
VStack {
Text("(account.nameOfAccount)")
.font(.subheadline)
.fontWeight(.semibold)
}
VStack {
Text(account.amountOfAccount, format: .currency(code: Locale.current.currency?.identifier ?? "USD"))
.font(.subheadline)
.fontWeight(.semibold)
.frame(maxWidth: .infinity, alignment: .trailing)
}
}
.swipeActions(edge: .leading, allowsFullSwipe: false, content: {
// Edit Account
Button(action: {
sheetEditAccount.toggle()
}, label: {
Image(systemName: "gearshape.arrow.triangle.2.circlepath")
})
.tint(Color.blue)
Divider()
// View Account
Button {
} label: {
Image(systemName: "eye.circle")
}
.tint(Color.gray)
})
.sheet(isPresented: $sheetEditAccount) {
print("Sheet Dismissed")
} content: {
EditAccountView()
.presentationDetents([.medium])
}
I have searched google and stackoverflow not sure if I am asking the right question. Cause I have yet to find something that makes since to me.