Swift Tutorial - Core Data Custom Objects

preview_player
Показать описание
Interested in learning Apple's new SWIFT Programming language? Learn how to initialize our Managed Context Object and use it to Serialize and Deserialize custom data classes!

Are you interested in being a game developer? Are you tired with the difficulty involved in learning and the lack of quality video tutorials? Fear not dear friends I am rm2kdev and it's my mission to bring you the highest quality game development tutorials spanning Unity3D, Game Maker, Visual Basic, C#, XNA and many more.

Please like and share this video

Swift Tutorial
IOS App Tutorial
Objective C
Apple Development
XCode
Mac App Development Please support the channel over on Patreon:
Рекомендации по теме
Комментарии
Автор

A little tip! When setting up the outlets and event handling there's a simpler way to do it. If you click the button in the very top right that looks like a bowtie (5th from the right) it'll show your source along with your storyboard. From there, instead of clicking and dragging to the yellow view controller box, you can click and drag into your source code and it will create the var or the func for you. 

marksest
Автор

The downcasting from Managed Object to a custom Object tip solved the exact problem I was having, I spent a few hours trying to fix it. Thank you, annoying it was so simple!

Jimi
Автор

Loving your Swift tutorials, I've watched all of them so far, very good ! What I've been wondering lately is how to work with MapKit vs Performance. The city where I live (Montreal) has open transit data (under the GTFS standard), so I just thought I could use it to test my skills regarding MapKit. So I did an app to display all the bus stops with point annotations (only those within the current region seen on the screen), took me a good 45 minutes to figure out how. The good part is : it works ! The ugly part is : when moving the map around, it takes between 5 to 10 seconds to fresh the data. >:-/ Anyways, this is a very specific example, but a little MapKit tutorial would be greatly appreciated nonetheless !

Looking at what you've done on your channel, I must say that I miss developing small games in RPG Maker ;)

pskx
Автор

Wow, another great tutorial on Core Data. Very concise and clear. Thank you so much Ryan.

tnsamath
Автор

Hey Ryan,
Great channel. Any chance of a simple Core Data tutorial with iCloud integration rather than local storage? Perhaps with an option for the user to choose which to use or merge?
Cheers

stitchwod
Автор

thanks for the nice tutorial. i have a question about sorting the data. how to sort the values from higher to lower? And display the most higher value on the text.

CutieStarz-
Автор

Hi, Ryan. I got the first CoreData tute working, but when I tried the custom objects one, it didn't work. In this code, the else block is executed, implying that entany is an NSManagedObject but not a Users. In the debugger the class shows up as NSManagedObject_Users_ iirc.

Any idea what might be wrong?

        let entany: AnyObject! = NSEntityDescription.insertNewObjectForEntityForName("Users", inManagedObjectContext: context)
        if let newUser = entany as? NSManagedObject {
            if let user = newUser as? Users {
                user.username = txtUsername.text
                user.password = txtPassword.text
            }else{
                newUser.setValue(txtUsername.text, forKey: "username")
                newUser.setValue(txtPassword.text, forKey: "password")
            }

markaurelius
Автор

Really thank you. Your video help me a lot. I stuck at swift dynamic cast error for 2 hours.

TanakritSaisillapee
Автор

Great Video, easy to following, looking forward to you next Swift video!

MR-xyvj
Автор

hi rm2kdev, thanks so much for your tutorials!
Recreating your app here I get this error upon hitting the save button:

2014-06-29 21:58:36.935 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'An NSManagedObject of class must have a valid NSEntityDescription.'

xCode then shows me the AppDelegate class in which I have merely imported CoreData and deleted the blank Window. Did it happen to you as well?

Robinbobin
Автор

Great job! Will you be making a tutorial for a game using the new SpriteKit by any chance? I wouldn't mind an endless runner maybe?!

geefambam
Автор

Hi, Do you know if we could eliminate redundancy in the app? For example I have saved the same object multiple times. And the results array contains two identical objects. And also could you make another video on how to delete a persisted object?

SyedAriff
Автор

I have one question for your sample, you taught us how to add/ get the data from core data, but how to reset/delete all the entities by programming? Or how to delete its sqlite file? I want to permanently delete useless data. Thanks!

peterxwl
Автор

HI! Where can i fine code resource from your tutorials? i dont find it in your website :) Thanks

Alon-chbb
Автор

Hi when I changed Entity class name to Custom class, it started giving me error..''MyCustomobject class is ambiguous for type look up in this context'..I have followed everything you have shown in video..Can you please help here.

kimtivaghasia
Автор

ok so I can get this to work on a brand new application however the moment I try this with the tabbed version for tasks I get the error I described on last video yes I added core data and I also added the core data to appdelegate I just can't seem to get it working if I could get on a Skype call with you would you be willing to talk me through what I may be doing incorrectly? thanks for another great video!

DeadlyDragon_
Автор

let appDel: AppDelegate = as AppDelegate
let context: NSManagedObjectContext = appDel.managedObjectContext

'AppDelegate' does not have a member named 'managedObjectContext'

What should I do? Xcode 6.0.1

Cfc
Автор

In your subclass, of NSManagedObject, you should be putting @NSManaged before each property that's in your model attribute or relationship, it tells the compiler that it will be supplied at runtime kinda like @dynamic. @NSManaged is for Swift Core Data only.

BeosDoc
Автор

Thank you for this tutorial, work very well.
It is possible to show how to load the password in the textField (or Label)  when you click "load"?
Thank you

christianbeyrend
Автор

Helo. How can i use more entity in my program? Because i created two entities but first entity is work but when i try to use second the program stop working :(

rEdht