Swift Tutorial - Core Data
Why Stack Overflow recommends it
Stack Overflow users link it as a step-by-step Core Data walkthrough in Swift, and many askers cite it as the tutorial they followed when their code broke.
Recommended by 2 people across 2 different months, 2014 to 2016.
What it is
A 28-minute Swift tutorial from game-development educator rm2kdev, from the early days of Apple's Swift language. It walks through initializing a managed object context in an iOS app and using Core Data to save and load persistent data.
What people said
Recommends the_pantless_coder · 2014-11 · Stack Overflow · on “Problems with storing UISwitch state”
@user3746428 I get back home later tomorrow and will post a complete answer when I am at comp with xcode on it. try this tutorial in the meantime [this video]
Recommends Tom el Safadi · 2015-11 · Stack Overflow · on “Save text entered from textfield to use it in other file [Swift]”
Use CoreData to save it in a database, then you can perform a fetch request to get it back out of the database. Very simple look it up here: [this video]
Cites Schuey999 · 2014-12 · Stack Overflow · on “Swift Core Data Issue (Xcode 6)”
Here is my code: var appDel:AppDelegate = (UIApplication.sharedApplication().delegate as AppDelegate!) var context:NSManagedObjectContext = appDel.managedObjectContext var newUser = NSEntityDescription.insertNewObjectForEntityForName("User", inManagedObjectContext: context) as NSManagedObject newUser.setValue("test username", forKey: "firstName") newUser.setValue("test password", forKey: "lastName") context.save(nil) println(newUser) println("Object Saved.") I've been following this tutorial step for step (with the exception of changing some variable names): [this video] I think my issue is within: var context:NSManagedObjectContext = appDel.managedObjectContext "appDel.managedObjectContext" does
Cites azimov308 · 2016-03 · Stack Overflow · on “Xcode 7 "Extra argument 'error' in call" Core Data Error”
I was experimenting with Xcode Core Data and I came across a problem. Here is the link to the tutorial I was using: LINK [this video] I also would like to mention that I tried googling this and have had no luck figuring it out for myself. Hopefully one of you guys could help me out here. Error Line The following line of code: "var results:NSArray = context.executeFetchRequest(request, error: nil)" has been giving me the warning "Extra argument 'error' in call" My steps towards trying to fix this: do try catch use Xcode 7 My code: import UIKit import CoreData class vcMain: UIViewController { @IBOutlet var txtUsername: UITextField! @IBOutlet var txtPassword: UITextField! @IBAction func btnSave(){ l
Cites PlateReverb · 2016-09 · Stack Overflow · on “NSEntityDescription.insertNewObject Function Causing Crash in Swift 3”
I'm following this introduction tutorial to this tutorial [this video] , and am completely new to Core Data. Here is the class that produces the error (however the error sends me to the first line of AppDelegate with a sigabrt. The line that begins "let newUser" seems to produce the error, because the error dissappears when I comment it out. @IBAction func btnSave(){ let appDel:AppDelegate = (UIApplication.shared().delegate as! AppDelegate) let context:NSManagedObjectContext = appDel.persistentContainer.viewContext let newUser = NSEntityDescription.insertNewObject(forEntityName: "Users", into: context) as NSManagedObject do { try context.save() } catch {} print("Object Saved.") } This problem loo