Post

Replies

Boosts

Views

Activity

Reply to Navigate from List to Detail in SwiftUI and CoreData
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(.....
Jan ’21
Reply to Picker
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()     } }
Jan ’21