Any idea why the "preview/canvas" doesn't run? We have to run it in the simulator. Is it an Xcode bug?
@BeyondOnesAndZeros
4 жыл бұрын
Good question! It is not an Xcode bug. The preview relies on the "ContentView_Previews" and not the "ContentView". We have to set the managedObjectContext environment for the "ContentView_Previews" as well. So you could simply add: ".environment(\.managedObjectContext, PersistenceController.shared.container.viewContext)" after the "ContentView()" in "ContentView_Previews". That should fix your problem. In practice this is quite nice because it also allows you to use a different viewContext for previews if you want.
@khram84
4 жыл бұрын
@@BeyondOnesAndZeros Thank you!
@khram84
4 жыл бұрын
@BeyondOnesAndZeros its odd, I added the code by copying and pasting it into "Contview.swift" in "ContentView_Previews" under "ContentView()", I am getting an error "Cannot PresistenceController in Scope"? I can see that exact in "ToDosListApp". What I am not getting here?
@khram84
4 жыл бұрын
Never mind, don't wast your time... I should read more thoroughly... I was putting the code below "ContentView()" instead of after it.
@BeyondOnesAndZeros
4 жыл бұрын
@@khram84 You're right, it should go right after it. Glad you sorted it out! :)
@kennethmerenda5046
3 жыл бұрын
This was a great video. I've been trying to find Core Data tutorials, but most of the ones out now are based on Xcode 11.x and earlier, with App and Scene delegate files. Your video was the first I found that used the new SwiftUI lifecycle and implemented the stack with Persistence.swift. Thanks!
@BeyondOnesAndZeros
3 жыл бұрын
Thanks Kenneth, good to hear that! :)
@WilfClegg
2 жыл бұрын
I've followed at least 10 tutorials on SwiftUI and Core Data. This is the first tutorial that showed me how to do an "update". None of the other videos included the update function for Core Data. Thank you, well done...and excellent explanations throughout the tutorial! Now I will take what you have taught me, and reformat it into an MVVM structured xCode framework. Beautiful!
@LeonaS-jd2wy
2 жыл бұрын
I've watched 3 to 4 Core Data tutorials, and this is the most and only clear one. Thank you and please keep making these high-quality tutorials.
@joeprince7509
4 жыл бұрын
Your deserve way more subscribers, thanks for continuing to publish these great videos!
@BeyondOnesAndZeros
4 жыл бұрын
Thank you, Joe! Good to hear that these videos are helpful. I really appreciate the support :)
@khram84
4 жыл бұрын
BeyondOnesAndZeros 100% agree with Joe. Hope we can help spread the word!
@ganeshmahajan1985
3 жыл бұрын
This is fantastic tutorial! Would you please create one with MVVM + Core Data as well ? Thanks a ton again! 👏🏻👏🏻👏🏻
@batuhankrbb
3 жыл бұрын
Bro, I'm in love with your tutorials. Whenever I see that you made a tutorial for the topic which I'm looking for, I feel amazing because you explained everything very well. Keep going!
@BeyondOnesAndZeros
3 жыл бұрын
Thanks Batuhan, glad you find them helpful! appreciate the support :)
@bjesusmoises
Жыл бұрын
This is the best tutorial that I found in YT, thanks!
@mariomatschgi344
3 жыл бұрын
OMG thank you so much for this nice tutorial! All other tutorials i found were either too old or just way to complicated - but yours is just perfekt! Have some cookies for your nice efforts 🍪🍪🍪
@bssgkmsd8
3 жыл бұрын
I've watched other core data videos. Your explanation is 100% better than all of them. Thank you for doing such a great video.
@BeyondOnesAndZeros
3 жыл бұрын
Thanks Bill, great to hear that!
@matthew78uk
3 жыл бұрын
Very helpful and well planned, many thanks!
@hcri
3 жыл бұрын
I have been following you for awhile and you have contributed allot for your viewers. I count myself lucky to be able to learn from your tutorials. One course you should think about would be JSON to Core Data.
@BeyondOnesAndZeros
3 жыл бұрын
Hi Robert, I appreciate your support! I have a question regarding your request.. are you suggesting a tutorial on loading a JSON from the web and storing it on the client as some kind of caching mechanism?
@maratkhanbekov9964
3 жыл бұрын
Thank you very much for such a simple explanation!
@arsenthompson
3 жыл бұрын
Thaaaankss!! Brilliant tutorial for work DB + UI, amazing work)
@dirrren5770
3 жыл бұрын
Thank you so much for clear and concise explaination on SwiftUI 2.0 core data!
@jovictor3007
3 жыл бұрын
Thank you , this is way more easier and less code than using property list to make a crud list app.
@JamesHaville
3 жыл бұрын
Finally got round to watching this - very nice summary! Thank you.
@BeyondOnesAndZeros
3 жыл бұрын
Thank you, James!
@CVHVisualsTutorials
3 жыл бұрын
Great tutorials! Much appreciated. I will let the communities be aware of your Channel.
@BeyondOnesAndZeros
3 жыл бұрын
Wow, thank you! I appreciate the support :)
@thebrettlarson
3 жыл бұрын
I stand corrected (and helped!)... This works! Great video.
@THE_ONLY_GOD
2 жыл бұрын
Thanks! Links to the code on github or another repository would be appreciated. (mainly for notes because sometimes screen didn’t show entire file content). Thanks in advance for editing the description to post that code.
@andrejkling3886
2 жыл бұрын
Thank you so much... Go Beyond
@ozanmuyes
3 жыл бұрын
Thanks for the through explanation and demoing. It was the first time I watched your video and I'm immediately sold 🙂 Going to watch other videos of yours. If it's not much to ask though can you use the dark theme?
@joltguy
3 жыл бұрын
Thanks for this great tutorial! Covered all the basics in a clear and understandable way. Would love to see how this can be adapted to work with CloudKit!
@BeyondOnesAndZeros
3 жыл бұрын
Thanks, Jeff! Good suggestion, it's already on my list. I will get to it as soon as possible :)
@BeyondOnesAndZeros
3 жыл бұрын
Hi Jeff, I finally got around to create the video on CloudKit: kzitem.info/news/bejne/p2t4nJqYjXOdY2k enjoy :)
@joltguy
3 жыл бұрын
@@BeyondOnesAndZeros Thank you! Checking it out now...
@AlbCaphalor
2 жыл бұрын
Excellent tutorial, thanks
@qsaluan
3 жыл бұрын
Phenomenal tutorial! Thank you so much for your work on this.
@BeyondOnesAndZeros
3 жыл бұрын
Great to hear that Quinn, you’re welcome! :)
@NTuneLabs
2 жыл бұрын
This was great. Maybe update for Xcode 13 and show a products based model, say for invoicing... just an idea.
@AbbeyOnAtkins
3 жыл бұрын
Concisely explained. Well done!!
@BeyondOnesAndZeros
3 жыл бұрын
Thanks Abolina!
@FckYouPlz
3 жыл бұрын
Great tutorial! The logics though need to be inside a ViewModel
@kasirajan2289
4 жыл бұрын
great work.. its very simple. Thanks..
@BeyondOnesAndZeros
4 жыл бұрын
Thanks, Kasi! :)
@johnr.5475
3 жыл бұрын
A great help. Thanks
@BlueMooseOnFire
3 жыл бұрын
What an amazing tutorial!!! Much appreciated. I had one question. Is it possible to test this on a live iOS device? When I switch the simulator to my actual device it complains about Task not being in scope. Is this a bug or can you not test core data application on a live device?
@何宇恒-t9h
3 жыл бұрын
Thank you !! However, NSManagedObject is a class rather than a protocol , right ?
@dmitrygolovin8066
2 жыл бұрын
Thanks for the awesome content!
@ryanbell5213
3 жыл бұрын
If I wanted to do a MVVM architecture, would I put the... @Environment(\.managedObjectContext) private var viewContext @FetchRequest(sortDescriptors: []) @Published var list: FetchedResults in the ViewModel??
@anandsunku
3 жыл бұрын
why does fetchresults does not require ViewContext but Contructor of Task in addTask does require one ?
@chris_bennett
3 жыл бұрын
Great tutorial, this helped me a ton - thank you so much! I have one question though: I want to move all the CRUD functions for the tasks into a TaskManager class because I want to keep my views as clean as possible. This works great, except for the part about updating. My method inside the TaskManager class is func update(_ shoppingItem: FetchedResults.Element, withTitle title: String) and I'm getting the error "Cannot find type 'FetchedResults' in scope". Any hints as to what I am missing? Passing the Task using the method call from the view does not seem to do the trick...
@mykytadubovik4993
3 жыл бұрын
Fine, thank you!
@poornabhaskarduvvari6436
4 жыл бұрын
Great Explanation👍
@BeyondOnesAndZeros
4 жыл бұрын
Thank you! :)
@annaovesna4440
3 жыл бұрын
Shutting down and launching Xcode again doesn't solve the "Cannot find type 'Task' in scope" for me, don't you have any other tip please??
@Nunny25
3 жыл бұрын
Hi, thanks for tutorial. How much record can be saved in Core data? It is suitable for large databases with thousands records?
@gandarainpanjaitan8595
3 жыл бұрын
Hi, thanks for this tutorial. I have an question, how to move fetch from core data into model?
@hallo_ween07
3 жыл бұрын
HELP I am getting this error message CoreDataNSManagedObject must have valid NSEntityDescription. What should I do i am a beginner! Thanks 🙏
@reshetn1koff
4 жыл бұрын
Nice tutorial. Thanks
@BeyondOnesAndZeros
4 жыл бұрын
Thanks, Aleksei!
@batissemanhardt8728
3 жыл бұрын
How would we have it so we can customize the tasks with a textfield?
@jiren8991
3 жыл бұрын
Thanks a lot
@gregohb
3 жыл бұрын
The app builds then crashes. it seems that the database is empty and possibly the pointer is negative to start. Fatal error: Unresolved error: nil: file CoreData2/Persistence.swift, line 18 2021-03-20 14:52:50.860348-0700 CoreData2[42026:4013387] Fatal error: Unresolved error: nil: file CoreData2/Persistence.swift, line 18 (lldb). Line 18 is this : if let error = error as? NSError? { fatalError("Unresolved error: \(error)")} Am I missing something? I have spent an hour on this, and gone over the video twice to make sure its precisely the same (AFAIK)
@saulramirez727
3 жыл бұрын
Insane buddy. Thanks a lot
@kevinbaize8574
3 жыл бұрын
CoreData: error: +[Task entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass Fatal error: UnsafeRawBufferPointer with negative count: file Swift/UnsafeRawBufferPointer.swift, line 872 2021-03-02 18:01:01.704378-0800 ToDO[6139:143889] Fatal error: UnsafeRawBufferPointer with negative count: file Swift/UnsafeRawBufferPointer.swift, line 872 I get this error above and not sure why. You have any idea?
@reece5863
3 жыл бұрын
At 13:40 xcode did not want to work with .environment. I had to restart xcode fresh and it all runs now. Maybe someone else has this issue...
@hsksearch3
3 жыл бұрын
Great!!!!
@hsksearch3
3 жыл бұрын
How to delete all tasks in one time? ^^ thank you
@draytond
4 жыл бұрын
Excellent tutorial! Very clearly explained. Could you use a Dark Theme for Xcode such as Midnight?
@BeyondOnesAndZeros
4 жыл бұрын
Thank you, Drayton! Sure, I will consider the dark theme for future videos :)
@draytond
4 жыл бұрын
@@BeyondOnesAndZeros Looking forward to it!
@ronnie149
3 жыл бұрын
I use a Post NSManagedObject class for some posts.. i use that post class for my main Feed View, for my Favorites View and my Profile View... how do i only save the Posts that use in my profile view. Do i need a separate context? A separate container? Maybe a coordinator? Can someone help me on this one
@nomonomadbisonware9218
3 жыл бұрын
I have two entities with a `Position` entity having a "to-many" relationship to an `Order` entity. I'm assuming I'd need to use an NSPredicate to filter the orders fetched by the matching position? I know the position entity has a property of type orders but it doesn't seem that accessing that property allows for smoother, natural animation like the fetch request process does. Would you be willing to create a video using relationships in CoreData and using NSPredicates?
@BeyondOnesAndZeros
3 жыл бұрын
Hi there, that’s an interesting example. I will cover entity relationships in more depth in a separate video maybe it will help you to solve your problem.
@dc5mike
4 жыл бұрын
Do you have any source code repositories for your examples?
@BeyondOnesAndZeros
4 жыл бұрын
Hi Michael, as of now I do not have a repo for my examples. But I will try to set one up and will get back to you
@dc5mike
4 жыл бұрын
@@BeyondOnesAndZeros any luck?
@irsyadashari5536
3 жыл бұрын
how do you know all of these stuffs ?
@vixell114
4 жыл бұрын
Sztosiwo! thx!
@ktmman1503
4 жыл бұрын
Brilliant .. great work indeed and thank you !... any chance of adding to your code, so that the user can add some text etc.. and also... incorporate iCloud too ? Thanks... Craig.
@BeyondOnesAndZeros
4 жыл бұрын
Thanks, Craig! That’s a great idea, I will cover these topics very soon in a follow up video.
@BeyondOnesAndZeros
3 жыл бұрын
fyi. there is now a video on CloudKit that covers the part on how to incorporate iCloud: kzitem.info/news/bejne/p2t4nJqYjXOdY2k
@quark67000
3 жыл бұрын
How do you go in line 18 from 11:39 state (with the text "completionHandler") to the 11:41 state (without "completionHandler", but with "in code") ? A cut in the video? A shortcut? Where is the explanation, please?
@BeyondOnesAndZeros
3 жыл бұрын
Hi quark67000, it’s a nice and handy Xcode auto completion feature. You access the auto completion by highlighting the spot that you want to “auto-complete” using the “Tab” keyboard key, and pressing the “return” keyboard key to replace the placeholder with the suggested auto-completion.
@quark67000
3 жыл бұрын
@@BeyondOnesAndZeros Thanks very much, I wasn't aware of this feature! Great!
@BeyondOnesAndZeros
3 жыл бұрын
@@quark67000 You're welcome :)
@user-rc2nt1tb2u
4 жыл бұрын
Hi , My app is so slow when launching, and it says that is more than 40 tasks , how can i fix this?
@BeyondOnesAndZeros
4 жыл бұрын
Hi Thuraya, are your launching your app on the simulator or a real device? Also it would be interesting to know the specs of your hardware that runs Xcode. Nevertheless, the simple code in this example should not lead to any crucial performance bottleneck.
@smartapps8770
4 жыл бұрын
I have this error in Xcode12: RemoteHumanReadableError: Failed to update preview. The preview process appears to have crashed. Error encountered when sending 'previewInstances' message to agent. ================================== | RemoteHumanReadableError: The operation couldn’t be completed. (BSServiceConnectionErrorDomain error 3.) | | BSServiceConnectionErrorDomain (3): | ==BSErrorCodeDescription: OperationFailed
@BeyondOnesAndZeros
4 жыл бұрын
Hi, please see the answer to the pinned comment. You should be able to solve this by simply setting the environmentObject to the preview.
@smartapps8770
4 жыл бұрын
@@BeyondOnesAndZeros I already have it, but still failed: struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() .environment(\.managedObjectContext, PersistenceController.shared.container.viewContext) } }
@BeyondOnesAndZeros
4 жыл бұрын
This seems to be a common issue with the new Xcode version. Did you add anything on top of what was shown in the video? Feel free to send me your project and I will check if it compiles on mine :)
@user-rc2nt1tb2u
4 жыл бұрын
Hi, Is it okay to have more than one big array (not json) of texts , colors , or images in my app(because i write it my own ) , and if not with what i can replace it? Thanks.
@BeyondOnesAndZeros
4 жыл бұрын
Hi Thuraya, Can you give me an example of what you are trying to achieve? Do you mean by writing “your own”, your own custom types?
@user-rc2nt1tb2u
4 жыл бұрын
I'm made an array that has more than 100 questions , and i wrote these questions my self.
@BeyondOnesAndZeros
4 жыл бұрын
It depends. If you have an app where you as the user create the questions using the app, it is totally fine. However, if you are creating these questions in code, it would be much more maintainable if you would load these initial questions from a JSON.
@user-rc2nt1tb2u
4 жыл бұрын
Thank you 🙏
@BeyondOnesAndZeros
4 жыл бұрын
You’re welcome :)
@advancedgame7362
3 жыл бұрын
Sorry but I have this error: [error] error: Failed to load model named TodoList
@advancedgame7362
3 жыл бұрын
I solved, I insert the wrong name in NSPersistenceContainer arguments. Great guide
@BeyondOnesAndZeros
3 жыл бұрын
Awesome, glad you figured it out! :)
@mhfs61
3 жыл бұрын
👍🏼👍🏼👍🏼
@user-rc2nt1tb2u
4 жыл бұрын
Where can i find the (App.swift ), the file with the @main keyword ?
@BeyondOnesAndZeros
4 жыл бұрын
Hi Thuraya, it’s part of the new Xcode Template. Create a new Xcode project and choose “App”, and in the next screen where you define the project name make sure to set the “Life Cycle” to “SwiftUI App”. If you do not see the option you’re probably running an older version of Xcode.
@kelvinjou4582
3 жыл бұрын
yeah, I think you're still using the appDelegate method
@sipanhazim4128
3 жыл бұрын
why you don't have unlike woow 😍😂
@BeyondOnesAndZeros
3 жыл бұрын
Haha thanks Sipan, appreciate the support 👍
@SebastiansBlog23
3 жыл бұрын
hey very good instructions. it doesn't work for me can i send you my code?
@BeyondOnesAndZeros
3 жыл бұрын
Thanks Sebastian. Sure, drop me a mail at beyondonesandzeros[at]gmail[dot]com
@BeyondOnesAndZeros
3 жыл бұрын
Hi Sebastian, I had a look and found out where your issue is. You are calling the ".navigationTitle("Todo List")" and ".navigationBarItems(trailing: Button("Add Taskt").." on the NavigationView but it should be called on the ending curly bracket of the List instead. That should fix your problem, give it a try and let me know :)
@SebastiansBlog23
3 жыл бұрын
@@BeyondOnesAndZeros Hey Beyond, it works :-) Thank you very much
@BeyondOnesAndZeros
3 жыл бұрын
@@SebastiansBlog23 Awesome! you're welcome :)
@thebrettlarson
3 жыл бұрын
This didn't work...
@BeyondOnesAndZeros
3 жыл бұрын
Hi Brett, do you mind sharing where you’re stuck and what error message you are getting?
@thebrettlarson
3 жыл бұрын
@@BeyondOnesAndZeros As soon as I build the project, it launches the simulator and crashes with an error "container.loadPersistentStores { (storeDescription, error)... Right around the 20 minute mark in the video if you are following along.
@BeyondOnesAndZeros
3 жыл бұрын
Your Xcode logs should show sth after: "Unresolved error: ". That’s the interesting part, that could help us to find the issue. Feel free to send me your current project and I will have a look at it :) beyondonesandzeros at gmail dot com
@thebrettlarson
3 жыл бұрын
@@BeyondOnesAndZeros That's amazing. I will send it to you and really appreciate your quick response and help! It's a great video and I was frustrated to hit the wall.
@BeyondOnesAndZeros
3 жыл бұрын
@@thebrettlarson I had a look at your source code. The issue is in the errorHandling of your PersistenceController.swift file. Please replace: "if let error = error as? NSError?" with "if let error = error as NSError?". Your current definition basically holds always true and throws a fatal error, even if everything is fine :) I hope this fixes your problem, if not let me know and I will have another look.
Пікірлер: 129