Post

Replies

Boosts

Views

Activity

Initialising a formatter object in a View body
I noticed something in the Structure your app for SwiftUI previews video, at 15:56 he says: "And now we can tell SwiftUI to format the text for this name at exactly the right time. This is as easy as defining a formatter..." https://developer.apple.com/videos/play/wwdc2020/10149/?time=950 var body: some View { 		let formatter = PersonNameComponentsFormatter() 		formatter.style = .long 		Text("\(name, formatter: formatter)") } It seems to me that this is not that easy for 2 reasons. I was under the impression we are not supposed to create reference types like a formatter object in the view body, or anywhere in the View that is not property wrapped. Supposedly it causes a heap allocation and slows down SwiftUI's updates. Maybe Swift has been improved to now allocate reference types on the stack instead of the heap and this is now OK? Given that PersonNameFormatter is dependent on the locale, surely if the locale is changed then the View body will not be recomputed because the View is not detecting a change. Is the Text View doing its own observing of the locale changes? If 1 is ok should the View simply subscribe to the locale changing some how? How would that be done? Or should we make an ObservableObject for the formatter? It can track the locale did change notification and set a new formatter as a @Published property. Use @StateObject in the View for this object so SwiftUI will know to recompute the body when there is a new formatter after a locale change so the person's name can be re-formatted. Or is my guess at 3 correct that Text handles the locale change for us?
0
0
1k
Oct ’20
Possible to override background push limits during development?
The video discusses limits to background pushes. I'm unable to finish developing my app that uses NSPersistentCloudKitContainer on iOS 14 because I believe background push notifications are being limited by the system so I am unable to test how the app behaves when it is suspended and a background push arrives. In fact I cannot get any background pushes to arrive at all, however pushes do arrive when the app is running in the foreground. Is there perhaps a development entitlement or launch param to override all limits so I can finish my app? And if not, can this feature be added please?
0
0
973
Sep ’20
UIListContentConfiguration: Cell not showing updated text
I created a UIListContentConfiguration, set the initial text and set it on the cell. Then I updated the text and was expecting the cell to show the new text and sadly that didn't happen. Here is some sample code: (void)configureCell:(UITableViewCell *)cell withEvent:(Event *)event { 		UIListContentConfiguration *content = cell.defaultContentConfiguration; 		content.text = event.timestamp.description; 		cell.contentConfiguration = content; 		 		[self performSelector:@selector(updateTest:) withObject:content afterDelay:3]; } (void)updateTest:(UIListContentConfiguration *)content{ 		content.text = @"Updated text"; } Then I noticed that cell.contentConfiguration is a copy property type. Perhaps the API could be improved to change it to a strong property type, and have the cell do KVO on the configuration's text so we can update afterwards and the cell will automatically update to the new text. The same way as how MKAnnotation and MKAnnotationView works for its coordinate, title and subtitle.
3
0
1.9k
Jul ’20
A suggestion for another way to implement public database syncing
In session wwdc20-10650 - https://developer.apple.com/videos/play/wwdc2020/10650/ "Sync a Core Data store with the CloudKit public database" at 14:22, Nick says "NSPersistentCloudKitContainer can't use CKFetchRecordZoneChangesOperation with the public database, it has to use CKQueryOperation". I was wondering why didn't you use CKSubscription? Create a subscription for each record type and the CKQueryNotification can contain CKQueryNotificationReasonRecordDeleted. It's been a while since I worked on my own public database sync but I think that is how I did it. This is the second time I've heard of the sync design being affected by limitations of CloudKit and it worries me. The first time it was when you decided not to use CKReference and instead create your own relation records because you said CloudKit had a limit on the number of references. Personally I didn't think the number was too low and I didn't understand why it couldn't just be raised, and if you had paired that with the non-public CKReferenceActionValidate it could have been a very solid solution. This year Nick came across as a bit unhappy with the current state of the sync, it was sad to see, compared to how enthusiastic he was last year especially getting to mention conflict-free replicated data type something he seemed really excited about. I really hope all of this can be resolved and the team can be happy again.
1
0
846
Jun ’20
Are Storyboard cell prototype styles also being deprecated?
I'm aware cell.textLabel is going to be deprecated from 25:40 in the video. I'm wondering in Storyboards is the cell prototype style also being deprecated? Because when I set cell.contentConfiguration it overrides the style chosen. Say if I chose the style right detail then when I set a configuration with a secondaryText then the cell appears as subtitle instead. Also, are Storyboards going to be deprecated in general?
1
0
771
Jun ’20
More info on restore state between split and tab hierarchies needed please
Please explain how and when the state should be transferred from split VC to tab controller when traits change from regular to compact. Please also consider then the middle “supplementary” column is in use. Please confirm we should no longer use adaptivity API given any showing alert or popover would likely be lost or should those also be in the state? Sample code of the relevant parts of the Shortcuts app would be very useful as this is a very difficult design pattern and it seems it is essential for cross platform apps targeting iPhone/iPad/Catalyst.
5
0
2.5k
Jun ’20
ChocolateChip WWDC 2019 sample code
I enjoyed watching the demos of the ChocolateChip app used in WWDC 2019 sessions 205 and 235, however not all of the source code was shown in the video, I was wondering if it would be possible for that project to be made available on the session video page? Because I have the following questions:What is the code for RecipesViewController.swift selectRecipe?- I was wondering if it performs a segue, also wondering if it selects a table row.What is the code for RecipesViewController.swift selectedRecipe?- I was wondering if it calls up to the split view controller to get the currently showing RecipeDetailViewController's recipe or if it simple relies on the table row selection.What does RecipeNavigationController.swift have in it?
3
0
999
Dec ’19