struct OnlyYou: View {
@State var selected: String = ""
let toSelect = ["aErnährung", "KörperPflege", "Reinigung"]
var body: some View {
VStack {
Picker("Select..", selection: $selected) {
ForEach(toSelect, id: \.self) { select in
Text(select)
}
}
Text("you selected: \(selected)")
}
}
}
struct OnlyYou_Previews: PreviewProvider {
static var previews: some View {
OnlyYou()
}
}
Post
Replies
Boosts
Views
Activity
I do not know so much of SwiftUI but try to replace @Binding with @State
may be that could help.
sorry but could it be that your code should be:
landmarRow(landmark: landmark[1])
just without the "s"?
I still could not solve my problem of "navigating" from list to a "ChangeEntity.swift". Even the famous "Bookworm" from "Hacking with Swift" only leads to a display of the data. So no change there either.
Has anyone ever "changed" CoreData at all? Adding and listing of Data works well.
Please: if someone has a solution, write me.
many thanks in advance.
@Environment(\.managedObjectContext) private var viewContext
@FetchRequest(
sortDescriptors: [NSSortDescriptor(keyPath: \Stock.bezeichnung, ascending: true)],
animation: .default)
private var waren: FetchedResults<Stock>
var body: some View {
NavigationView {
List {
ForEach(waren) { ware in
// <within a well doing List, it is not possible to send a Textfield to Screen always:>
// <Error: Cannot convert value of type 'String' to expected argument type 'Binding<String>'***
TextField("bezi", text: ware.bezeichnung!)
NavigationLink(
destination: StockAendern(ware: ware))
{
VStack(alignment: .leading) {
Text("\(ware.bezeichnung!) in \(ware.mengenEinheit!)")
HStack {
Text(.....
May be the 1. sample does not show enough. here is the data-model
For further documentation CoreDataPropertiers - https://developer.apple.com/forums/content/attachment/735e4865-e72b-4356-a6bf-65a60446b675
This problem is solved in the meantime.
Hello
in fact i'm getting the same messages in the debug area of the Xcode window. But there are no Compile Errors nor functional problems (not to talk about my own problems in understanding SwiftUI).
Dear jjatie
thank you very much, I copied your code and it works well. So I can continue.