Post

Replies

Boosts

Views

Activity

Reply to Xcode 14 Donut App Sample Code
Sure. The project itself is called Food Truck. Documentation with link to download: https://developer.apple.com/documentation/swiftui/food_truck_building_a_swiftui_multiplatform_app GitHub page: https://github.com/apple/sample-food-truck And link to all the sample code used in the WWDC 2022 videos here: https://developer.apple.com/sample-code/wwdc/2022/
Jun ’22
Reply to FetchedResults to Array
Just to confirm you have an NSSet of objects and you can't turn it into an array, right? Getting an error/warning for Cast from 'NSSet?' to unrelated type '[EntityName]' always fails... There's a parameter allObjects on, at least, the Core Data relationship NSSet that you can use to convert it to an array. In my case I use it when taken a set of Entities from a relationship. So: FirstEntityName?.relationshipNameWithNSSet?.allObjects as? [SecondEntityName] If they NEED a result I sometimes use ?? [SecondEntityName]() to create an empty default array.
Jun ’22
Reply to Core Data Entity Inside Another Entity
Not sure what the persistence file would look like but like @MatKuznik said you'd need a relationship. Remove the binary data recipe from PlannedRecipe. Then add a relationship (called recipe) to PlannedRecipe. In Recipe itself add a relationship to PlannedRecipe (I'll call it plans for now). Both will have to point to each other so switch the third tab to the other one so they point each way. On the far right pane you'll want to direct if it's a one-to-many (one-to-one or many-to-many) relationship by setting either side. I'd image a recipe can be in multiple planned recipes but a planned recipe can only have one plan? Unless your plan consists of multiple (WWDC example with pie crust, filling, and whip cream idea comes to mind) in which case you'd want a "to-many" on either side.
Jun ’22
Reply to Testing CloudKit Apps using the simulator
I've gotten my iPad hooked up so I have two devices to test with (macOS and iPad). That said I'm still curious to know whether I can log into a simulator (either with my own Apple ID or a dummy one - how to create?) so I can test through my computer or try it on other simulated devices I don't own.
Jun ’22
Reply to iOS game App Rejected due to App Unresponsive
I haven’t submitted an app yet and so can’t tell you. That said, I asked about app submission in a lab session at WWDC this year and was told if I was rejected I could ask for call clarification so I’d know the why. I wonder if they could also answer your question then too. I haven’t watched it yet but was also referred to this video (not sure what it goes over): https://developer.apple.com/videos/play/tech-talks/10885
Jun ’22
Reply to Good tutorial for hooking CloudKit into a SwiftUI project.
If anyone is curious the first part of a post (https://www.andrewcbancroft.com/blog/ios-development/data-persistence/getting-started-with-nspersistentcloudkitcontainer/) got me started and then the Apple Documentation - specifically Setting Up Core Data with CloudKit to me the rest of the way. I mostly jumped around the documentation from there (got data loading when I started the app) and then Hacking with Swift got me the rest of the way.
Jun ’22
Reply to Xcode on macOS Ventura
I had the same issue. The App Store Xcode doesn't work as Ventura has bypassed it. Since we're using the Beta the warning hasn't upgraded, I'm assuming. After reinstalling several times I realized I needed to download the Xcode Beta (not in the App Store) and it now works.
Jun ’22
Reply to Storyboard target in Beta
In case anyone has the same issue going to get around it by NOT using the storyboard file. Instead set the Plist Launch Screen background color (skipping image as it's stretched weirdly) and creating a custom LaunchScreen view that the app goes through before ContentView. Since they both have the same background color it merges from the default "launch screen" then my custom one and finally my main app ContentView.
Jul ’22
Reply to Canceling an Edit: When to alert?
I ended up using the coreData entity and set most controls to the entity's property. This way I could use the ViewContext.hasChanges to determine if I need to ask a user before canceling the form. I had issues with the Toggle and Picker as they wouldn't be set/changed in the edit form but when left the value was updated. I ended up using @BabyJ second post (thanks for the code) to extract a temp variable from the Entity onAppear and set the value onChange. This fixed the controls!
Jul ’22
Reply to CoreData causing error running Mac App - Is there a way to reset app so it starts fresh?
Fixed it by destroying more my store through the code. Basically right after creating my container in the persistence file I added: `do{ try container.persistentStoreCoordinator.destroyPersistentStore(at: container.persistentStoreDescriptions.first!.url!, type: .sqlite, options: nil) }catch{ print(error) } Works great now. Solved it by asking this question in stackOverflow. Full question and answer here: https://stackoverflow.com/questions/73094220/how-to-fully-remove-macos-xcode-application
Jul ’22
Reply to Plist values in Xcode Beta
UPDATE: I figured out how to get past this error by going to App > Target > Info tab and added the three Privacy - Health... Usage Description Strings. My issue now is I'm getting Code 1 Health data is unavailable when running on my non-beta Mac AND my beta iPad. I get error 4 when run on my simulator. Specifically Code=4 "Missing application-identifier entitlement. Is there anyway to debug/work with health data in a development setting? Or is there a way to get it working on the simulator?
Sep ’22