//
// TestZhangBenPicker.swift
// pandabill
//
// Created by 朱洪苇 on 2024/1/14.
//
import SwiftUI
struct TestZhangBenPicker: View {
@FetchRequest(
sortDescriptors: [
SortDescriptor(\.cc_at)
],
animation: .default
)
private var zhangbens: FetchedResults<ZhangBenEntity>
@State var selection_zhangben: ZhangBenEntity?
var body: some View {
VStack (spacing: 200) {
Text("账本数量 \(zhangbens.count)")
Text(((selection_zhangben?.name ?? "default")))
Picker("请选择账本", selection: $selection_zhangben){
ForEach(zhangbens, id: \.self){ (zhangben: ZhangBenEntity) in
Text(zhangben.name!).tag(zhangben as ZhangBenEntity?)
}
}
}
}
}
struct TestZhangBenPicker_Previews: PreviewProvider {
static var previews: some View {
TestZhangBenPicker()
}
}
熊猫小账本
一个简洁的记账 App,用于记录日常消费开支收入,使用 iCloud 保存同步数据。