Background:
I'm new-ish to Swift and Apple ecosystem development, created two simple apps in Xcode, a change counter that I came up with, and one of the SwiftUI tutorials, Landmarks. I'm also nearing an AAS degree in computer programming.
I'm trying to create a recipe app -- well, more of a relaunch but that's not important -- using SwiftUI, CoreData, CloudKit, and other recent frameworks. And, quite frankly, I'm finding Apple's documentation lacking/confusing. Therefore, I'm hoping for someone to at least point me towards some good, basic examples and/or documentation/tutorials.
Sensibly, I want to take this on in testable steps. Implement the basic core storage and get it to display in the general format I desire -- finesse tweaking can happen later -- then additional views for search, then cloud syncing, and so on.
The Current Roadblock:
I've created a new project (Xcode 11.5), added an entity plus attributes, and now attempting to seed my storage, i.e., create records. I know of the PersistentContainer, NSManagedObjects, NSEntityDescription, NSManagedContext, AppDelegate, etc though can't seem to put them all together correctly.
Basically, I want a Swift version of
Perhaps even as part of a Swift version of the following in an InitialReciipes function, in the main SwiftUI view, or wherever is best practice.
Again, I'm not asking for step-by-step instructions, more of an understandable, complete, basic, template would be nice, or at least an actually helpful tutorial.
Thanks.
I'm new-ish to Swift and Apple ecosystem development, created two simple apps in Xcode, a change counter that I came up with, and one of the SwiftUI tutorials, Landmarks. I'm also nearing an AAS degree in computer programming.
I'm trying to create a recipe app -- well, more of a relaunch but that's not important -- using SwiftUI, CoreData, CloudKit, and other recent frameworks. And, quite frankly, I'm finding Apple's documentation lacking/confusing. Therefore, I'm hoping for someone to at least point me towards some good, basic examples and/or documentation/tutorials.
Sensibly, I want to take this on in testable steps. Implement the basic core storage and get it to display in the general format I desire -- finesse tweaking can happen later -- then additional views for search, then cloud syncing, and so on.
The Current Roadblock:
I've created a new project (Xcode 11.5), added an entity plus attributes, and now attempting to seed my storage, i.e., create records. I know of the PersistentContainer, NSManagedObjects, NSEntityDescription, NSManagedContext, AppDelegate, etc though can't seem to put them all together correctly.
Basically, I want a Swift version of
Code:
var taco = new Recipe
{
name: "Taco",
ingredients: "1 package of taco shells, 1 tomato, ...",
...
}
var burger = new Recipe
{
name: "Bean Burger",
...
}
Code:
import CoreData
class ManageData
{
var context = ...
public void addRecipe
{
// insert into
}
...
}
Again, I'm not asking for step-by-step instructions, more of an understandable, complete, basic, template would be nice, or at least an actually helpful tutorial.
Thanks.
Last edited: