Implementing our View model
We need to create a few methods that will save data to Core Data and pull data out of Core Data. I have started CreateAccountViewModel
for you. Everything you will add will be focused on things you need to know. Please take a minute to review all of the properties I added for you to use later.
First, let's create a method for creating an account. After the uiColors
variable, add the following method:
func createAccount() { let currentAccount = Account(context: CoreDataManager.shared.context) // (1) CoreDataManager.shared.context.perform { // (2) let accountNo = UUID().uuidString.suffix(6) // (3) let currentCard = Card(context: CoreDataManager...