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?
Post
Replies
Boosts
Views
Activity
Can't seem to copy the code from the code tab in the Developer app for this session. It even says "copy code supported" under the title, anyone know the secret?
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.
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?
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.
Every day I visit the forums I have to sign in again despite having ticked the "remember me" check box on the login form.
Having to sign in again to make the simplest action of upvoting an answer makes me not want to bother.
Safari Version 13.1.1 (15609.2.9.1.2)
macOS Catalina 10.15.5 (19F101)
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.
E.g. When I search for nsfetchedresultscontroller the first result is 5 years old which makes me very sad.
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?
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?
At 21:40 in the video the following code is shown:
(sorry for the screenshot but this talk doesn't have code copy enabled)
Luca points out this results in new view and storage every time dayTime changes. Say you wanted to fix it so it doesn't create a new view and storage every time, how would you do that?
Like this maybe?
var body: some View {
let cr = CatRecorder()
if dayTime {
return cr.nightTimeStyle()
}
else {
return cr
}
}
But this code doesn't look very declarative. I've seen many struggle with applying modifiers conditionally (especially .hidden()) so thought I'd ask.
I enjoyed the video thanks. At 6mins when David said "You don't need to do anything else and your data will be indexed in Spotlight.". What immediately came to mind was what about cleaning up the persistent history?
I had a brief look at the docs and noticed that indexDidUpdateNotification includes NSPersistentHistoryTokenKey should we listen for that and then purge the history?
And what if we have multiple components requiring use of the persistent history? Is there a recommended strategy for deleting only the history not required by the Spotlight indexer and other components?
Hi Nick, I've implemented by own sync that works the same as Notes but it requires using the private CKReferenceActionValidate. Could you help make that public? Cheers
See
https://developer.apple.com/forums/thread/652267
and
FB6114162 - 4 Jun 2019
The presenter says "you might be wondering why we don't do this with CKReference instead. And that's because CKReference has some limitations that we don't think work well for Core Data clients. Namely that it's limited to 750 total objects."
However, that isn't correct, the 750 limit is only for references that have a delete action:
https://developer.apple.com/documentation/cloudkit/ckrecord/reference
Important
There is a hard limit to the number of references with a CKRecord.ReferenceAction.deleteSelf action that any one record can have. This limit is 750 references, and any attempt to exceed it results in an error from the server.
This is why the Notes app has no issue with more than 750 note records with a reference to a folder record.
I really wish NSPersistentCloudKitContainer had used CKReference and also that _CKReferenceActionValidate was made public. CKShare has limitations too, yet it used that and there was no custom sharing done like custom references were done.
In the slides at 11:50 the following code snippet is shown:
.backgroundTask(.urlSession("isStormy")) {
// ...
}
Please could you explain what should be done in this block? The video just cuts off right after and seems like the explanation is missing. Thanks.