Posts

Post marked as solved
4 Replies
Hi ClaudeThanks, WWDC Video was good in proving the contraints that need to be set.
Post marked as solved
4 Replies
Hi ClaudeThis is ideed for Swift. But for Cocoa not UIKit. So far, I've set NSTableView's Row-Size-Style to "Automatic (Auto Layout)". But not able to figure out what to do next?Any help is really appreciated.
Post not yet marked as solved
7 Replies
Without navigation, the closest one can do is generate new views for every clickimport SwiftUI struct ContentView : View { @State var clickedContent: RandomListStruct? @State var clickedUseCase: Int? var var_list : [RandomListStruct] let zero = "use a default view as in WWDC video" var body: some View { HStack (alignment: .top) { VStack (alignment: .leading){ List (selection: $clickedContent) { Text ("Master Record").color(.orange) Divider() ForEach(var_list.identified(by: \.self)) { rls in HStack { Text("\(rls.name)") Spacer() Text("\(rls.address)") } } } }.frame(maxWidth: 250, maxHeight: .infinity) VStack { List { Text ("Details ").color(.orange) Divider() if (clickedContent?.name ?? zero) == zero { Text("Please select a Row").color(.red) } else { VStack(alignment: .leading) { Text("Name : \(clickedContent!.name)").color(.green) Text("Address : \(clickedContent!.address)").color(.green) } } } }.frame(maxWidth: 500, maxHeight: .infinity) } } } struct RandomListStruct: Hashable, Codable, Identifiable { var id : Int var name : String var address : String } let var_list1 = [ RandomListStruct(id: 1, name: "John", address: "200 Hollywood"), RandomListStruct(id: 2, name: "Jane", address: "212 Willowdale"), RandomListStruct(id: 3, name: "Ishan", address: "801 Elmwood"), RandomListStruct(id: 4, name: "Kris", address: "214 Front"), RandomListStruct(id: 5, name: "Ishani", address: "215 Bay St") ] #if DEBUG struct ContentView_Previews : PreviewProvider { static var previews: some View { ContentView(var_list: var_list1) } } #endif
Post not yet marked as solved
7 Replies
Assuming that you want to use the Master-Details pattern, I think that Approach should be to use Navigation Controls and not use the List (as list will require using binding and glue-code to display Details: this is a lot of work for a basic UI pattern, way too complex).The Master-details pattern, on WWDC slides uses Navigation controls:https://developer.apple.com/videos/play/wwdc2019/216/ at 55:10 and slide 278 onwards.The issue appers to be that Mac implemention of SwitUI is pretty buggy and thus Navigation is not available. I am pretty sure that Developers at Apple are getting beaten eveyday to fix SwiftUI (fill the the gap between over-promised and under-delivered features). I am skeptical that it Mac SwitUI will be even ready for September Release.
Post not yet marked as solved
24 Replies
Good solution.The changes I would suggest is adding id to the ViewModel to make it unique and using didSet to update the backing store.
Post not yet marked as solved
24 Replies
The framework is a mix of Microsoft's MVVM and Facebook's DOM-based React framework.- Based on the recommended approach (XCode Preview session), you should not mutate the Core-Data Entity.- Instead, the bindings to the ViewModel triggers update of the UI.- This also makes sure that your UI is dependent on design time ViewModel (and not run time core-data)= Better testing, better preview support, better maintenance.The big unknown is how performant SwiftUI will be in the real word