Post

Replies

Boosts

Views

Activity

Core Data
So I was just following along with CodeWithChris's video on make a persistent data storage (https://youtu.be/O7u9nYWjvKk) and I got to the part where he says to include the subclass NSManagedObject to the family and person classes. I have a very similar program with recipe and list of recipes, but when I add "NSManagedObject" I get an error: < unknown >:0: error: stored property '_title' requires an initial value CoreData.NSManagedObject:2:12: note: superclass 'NSManagedObject' requires all stored properties to have initial values open class NSManagedObject : NSObject { < unknown > :0: error: stored property '_calories' requires an initial value CoreData.NSManagedObject:2:12: note: superclass 'NSManagedObject' requires all stored properties to have initial values open class NSManagedObject : NSObject { etc. Unsure of how to fix it. Any help would be greatly appreciated. Code in case I'm missing something RecipeList: import Foundation import CoreData class RecipeList:NSManagedObject, Identifiable{     @Published var recipeList:[Recipe]     init(){         recipeList=[]     }     func addRecipe(recipe: Recipe){         self.recipeList.append(recipe)     }     func removeRecipe(loc: Int){         self.recipeList.remove(at: loc)     }     func getList() -> Array<Recipe>{         return recipeList     } } Recipe: import Foundation import UIKit import CoreData class Recipe:NSManagedObject, Identifiable{     @Published var title: String     @Published var calories: String     @Published var ingredients: Array<String>     @Published var instructions: Array<String>     @Published var totalTime: String     @Published var notes: String     init(title: String, calories: String, ingredients: Array<String>, instructions: Array<String>, totalTime: String, notes: String){         self.title=title         self.calories=calories         self.ingredients=ingredients         self.instructions=instructions         self.totalTime=totalTime         self.notes=notes     } }
0
0
369
May ’22
Toolbar Above Keyboard
I would like to implement the “Toolbar” kind of thing above the keyboard shown in the image that includes an up and down arrow to iterate through text fields and a done button to dismiss the keyboard. How do I do this? Thanks!
0
0
339
May ’22
Airdrop CoreData
I need to share a singular instance of an object created in core data. Every video I've found that showed how to do this used outdated code and I was wondering if anyone had a working way to either create the airdrop button (because I don't even know how to do that yet, or make it so that the data is share is a duplicate of the object from the sharers device. Thanks! This is the entity that needs to be shared via airdrop:
0
0
309
Jun ’22
NavBar Format
How has GitHub formatted their navigation bar like this? The title is aligned with the back button and add button, the search bar is inside instead of under, and they have buttons alone the bottom that filter the list. Is there a view object that shortcuts this? If you understand even one part of that I would appreciate that information. Thanks!
0
0
342
Jun ’22
Calendar That Stores Data
Does anyone know the best way to store core data using a calendar? The only way I could think is adding a date attribute and every time the date is changed on the calendar changing the NSPredicate to that date and if there isn’t one creating a new instance with that date as it’s date value. I’m certain this is not the best method, but I couldn’t think of any other, but I know I’m very limited in my SwiftUI knowledge. So any guidance would be greatly appreciated. For more insight into what I’m looking for see my previous post asking for advice on what to change about my own method: https://developer.apple.com/forums/thread/708915
0
0
918
Jun ’22
TabView Item Back to Main View
So I have a TabView in my app and I want to go back yo the main view when that tabItem is pressed. For example, when you open the App Store and go to the games tab, click on a game. It takes you to a navigation link to a new view. You can either go back to the first page by pressing the arrow, or by tapping the “games” tabItem again. I want to be able to press my tabItem in a subview of the same tab to go back to the original view that the tab is assigned to.
0
0
621
Jun ’22
AirDropping Core Data
So I know this is probably a stretch, but is there any way to airdrop an object from core data? From what I understand airdrop is only used with links, but is there a way to convert the data of a core data object into a file, convert the file into a link, send it via airdrop, and convert it back into a file, and then add that object from a file to another user's core data storage? Any help would be greatly appreciated. Thanks!!
0
0
640
Jun ’22
Tab item but that takes you back to main view
So I have a TabView in my app and I want to go back yo the main view when that tabItem is pressed. For example, when you open the App Store and go to the games tab, click on a game. It takes you to a navigation link to a new view. You can either go back to the first page by pressing the arrow, or by tapping the “games” tabItem again. I want to be able to press my tabItem in a subview of the same tab to go back to the original view that the tab is assigned to.
0
0
637
Jul ’22
Safely Storing User Logins
I'm developing an app that has accounts with usernames and passwords to log in. So far I have found firebase, which doesn't look bad, but I'd like to know every available option and what they have to offer before committing to one. I was curious if Apple had some sort of kit for developers for a login system. And if not maybe other options for this. Thanks for any help!
0
0
575
Jul ’22
Log In With CloudKit
I'm developing an app that has accounts with usernames and passwords to log in. So far I have found firebase, which doesn't look bad, but I'd like to know every available option and what they have to offer before committing to one. I was curious if Apple had some sort of kit for developers for a login system. Like CloudKit for example, can CloudKit be used to store log in info and be reached when the user is logging in? And if not maybe other options for this. Thanks for any help!
0
0
550
Jul ’22
How to Share an Object Through Airdrop
So I know this is probably a stretch, but is there any way to airdrop an object from core data? From what I understand airdrop is only used with links, but is there a way to convert the data of a core data object into a file, convert the file into a link, send it via airdrop, and convert it back into a file, and then add that object from a file to another user's core data storage? Any help would be greatly appreciated. Thanks!!
0
0
1.3k
Jul ’22