Post

Replies

Boosts

Views

Activity

Reply to Maximise Image above Form
Hi Timo2303, Avoiding Form altogether and designing a nice report instead, as you indicated, is actually a very good solution. It seems Forms are not made for this purpose as their dimensions are just the portion displayed on screen at any time. Thank you very much for the hint and the code! Cheers F
Feb ’24
Reply to @EnvironmentObject with array of class
Thanks again - you brought me on the right track! Different combinations of VStack and List did not help but moving the code from the sub-view back into the main view did the trick. As a work-around that's fine but I would still be interested to learn some backgrounds on the issue with List.Would you have a reference for that?
May ’20
Reply to @EnvironmentObject with array of class
Thanks Claude31, you understand things correctly.From ContentView I basically call a sub-view 'MainListView' that draws a List using the 'contacts' array by looping through it and calling another sub-view 'ListRowView' with a parameter 'contact'. This call (line 13) does not result in an update. If I add line 12 (displaying the same info directly) it updates as expected and even the info from the sub-view is updated (shown twice then). Just having line 13 without line 12, it does not update.struct MainListView: View { @EnvironmentObject var appEnv: AppEnv var body: some View { List { ForEach(appEnv.contacts, id: \.self) { contact in NavigationLink( destination: ContactDetailView(contact: contact)) { Text("\(contact.getFirstLine())") <-- this works ListRowView(contact: contact) <-- this doesn't } [...] struct ListRowView: View { var contact: FtContact var body: some View { Text(contact.getFirstLine()) [...]
May ’20
Reply to @EnvironmentObject with array of class
Thanks for your reply - imagine a very generic class with a couple of attributesclass FtContact { private var identifierKey: String private var givenName: String private var familyName: String [...] func getIdentifierKey() -> String { return identifierKey }that are accessible through some getters. The AppEnv class has a function that changes the content of its @Published variables like this: func refreshAll() { contacts = db.selectContacts() contacts.sort(by: { $0.sortValue() < $1.sortValue() }) cnt_refreshAll = cnt_refreshAll + 1 }One the view, cnd_refreshAll changes immediately but attributes of contacts are not displayed.
May ’20