Post

Replies

Boosts

Views

Activity

Reply to UIListContentConfiguration: Cell not showing updated text
It all sounds good in theory but in practice this design of atomic updates doesn't work. We cannot update the text without losing the entire state fo the cell. E.g. if the cell has been swiped to show the delete button. Then if we need to update the text (because of a background update for example) when we set a new configuration the swiped state is also lost. The cell is left in an inconsistent state - it's indented but the delete button has disappeared. I suppose we could retrieve the current state from the cell, update it and then set it again on the cell. But it would be much simpler if the cell just listened for changes to the configuration object, as I attempted in the code in my question. I submitted a feedback about this FB7977764
Jul ’20
Reply to OutlineGroup and hierarchical List with Core Data
I converted both the relation and the fetch-results to arrays. Give it a try: extension Folder : Identifiable {     public var foldersArray: [Folder]? {         let set = folders as? Set<Folder> ?? []         return Array(set)     } } struct FolderView { 		@FetchRequest(entity: Folder.entity(),sortDescriptors: [NSSortDescriptor(keyPath: \Folder.position, ascending: true)]) 		var folders: FetchResults<Folder>     func foldersArray() -> [Folder] {         return Array(folders)     }     var body: some View {         OutlineGroup(foldersArray(), children:\.foldersArray) { folder in             Label(folder.name, systemImage: "folder.fill")         }     } }
Jul ’20
Reply to State in the Interface
If you look at the header for List you'll notice it says: "On iOS and tvOS, you must explicitly put the list into edit mode for the selection to apply." This means that the selection binding (when not in edit mode) only works on macOS, not iOS. This results in iOS losing the selected row as you noticed at 8 mins in the video. Hopefully the selection binding can be brought to iOS in a future beta. I'd also like it to work in compact in the following situation. Select a row and a view is pushed on the nav, then change the view (and the selected row) using arrow keys (like in Mail), and when the view is popped off I'd like to see this row's unhighlight animation not the original one.
Jul ’20
Reply to A suggestion for another way to implement public database syncing
And I'd like to add that the subscription (including its predicate) could be stored in a managed object. Records being synced are related to that subscription object. E.g. take the scenario where the user marks a rectangle on a map. A subscription is created with the predicate being the bounding box. The initial set is downloaded using a query and any record changes arrive via push notifications. When the user removes the rectangle from their map, the subscription can be removed from the server, and all the local records can be deleted. Related data has additional challenges but there are a few possibilities for how to handle that sensibly.
Jun ’20
Reply to How to distinguish between adding and viewing in one DocumentGroup Scene?
init is called on your Document when the + is tapped. When an existing document is opened init(fileWrapper: FileWrapper, contentType: UTType) is called. Remember in SwiftUI the body method is called multiple times to create all the structs but doesn't mean that anything will actually happen, for example if all the structs built are identical then the diff won't detect any changes thus nothing will change.
Jun ’20
Reply to Using new UISplitViewController features with Interface Builder/Storyboards
In the storyboard I selected the split view controller and set a run time user defined attribute of style number 2 (for 3 column mode). Then I disconnected the relation segues and instead set storyboard identifiers on them then in code I instantiated then using the identifiers and used the setViewController forColumnType method for each of the 3 columns. To show a new Secondary you can use the showDetail segue but there doesn’t appear a way to use a segue to the Supplementary column. For that use showColumm and it works both when collapsed and separated. It might also be a better idea to use that method for showing the Secondary. I’m hoping they add storyboard support in beta 2.
Jun ’20
Reply to Section titles with UITableViewDiffableDataSource
After you init self.dataSource to a UITableViewDiffableDataSource (which sets itself to the tableView.dataSource) set the tableView.dataSource back to self, i.e. the UITableViewController subclass. Now in your numberOfSectionsInTableView and numberOfRowsInSection methods forward those to self.dataSource and return its info (this is the composition pattern). Now your UITableViewController just implements its section titles as normal since it is the table's data source.I believe UITableViewDiffableDataSource should not be setting itself as the dataSource if one is already set but I guess they designed it to work in the least error prone way because with UITableViewController added to a storyboard its already set.If you do it this way then it makes sense why the class wasn't open in the early iOS 13 betas.
Jun ’20