Swift Realm Tutorial: How to use a local realm database with SwiftUI - iOS Basics

  Переглядів 9,924

Karin Prater

Karin Prater

День тому

In this iOS tutorial you will learn how to read and write data with Realm Database for SwiftUI. Realm is a powerful solution to persist data for iOS. We will build an example project in SwiftUI with realm and use the newest updates like @ObservedRealmObject and @ObservedResults, which make it soo much better.
Overview
00:00 what you will build
03:14 project setup , loading Realm packages
04:16 define data models
09:23 views with @ObservedRealmObject
20:47 delete crash
28:09 making the SwiftUI preview work for realm
36:17 @ObservedResults vs RealmSwift.List for sorting and filtering
49:06 wrap up
Official tutorials from Realm:
docs.mongodb.com/realm/sdk/sw...
docs.mongodb.com/realm/sdk/sw...
⬇️ Project files: github.com/gahntpo/RealmSwift...
My earlier tutorial about realm: • How to use realm in Sw...
If you liked what you learned and you want to see more, check out one of my courses!
👨‍💻 my SwiftUI course school.swiftyplace.com/course...
👨‍💻 my Core Data and SwiftUI course school.swiftyplace.com/course...
👩🏻‍💻 Combine course
school.swiftyplace.com/course...
#SwiftUI #Realm #iOSDevelopment

КОМЕНТАРІ: 18
@MrLidakis
@MrLidakis Рік тому
Very nice, neat and simple tutorial for a beginner on realmdb with swiftUI. Thank you!
@fengyuanyap6590
@fengyuanyap6590 2 роки тому
Thank you for the tutorial, the realm documentation is a bit confusing, but got them clear in your explanation.
@user-mt1mz9og6t
@user-mt1mz9og6t Рік тому
Thank you for this great tutorial! 🙏🏼
@kenturnbull9679
@kenturnbull9679 2 роки тому
Sehr Gut! I am looking forward to more of this series...based on the title saying 'Part 1'. I still think about databases in relational terms and have been trying to convert an old project done with Oracle/MySql to SwiftUI, so relationships in Realm are important to me.
@codylimongello
@codylimongello 2 роки тому
Thank you for this info!!
@fanggladys9986
@fanggladys9986 Рік тому
you are absolutely amazing, thank you so much
@iziman99
@iziman99 Рік тому
Enjoyed this video very much. This was my first contact with Realm. Very useful! :)
@AndrewDChristie
@AndrewDChristie 2 місяці тому
Thanks!
@kenturnbull9679
@kenturnbull9679 Рік тому
With regard to searchable text, could you show a toggle that lets the user find text that BEGINSWITH or CONTAINS?
@fjarm
@fjarm 2 роки тому
Does Realm support unique contraint? And hows the performace yeah?
@HenningMoeller
@HenningMoeller 2 роки тому
Hallo Karin, ich verfolge deinen Channel und lerne bei jedem Video dazu. Dank deiner Videos, stecke ich mitten in einem privaten Projekt, dass ich in den nächsten Wochen / Monaten zu Storereife bringen möchte. Ich finde kaum gutes Material in dem Realm und Core Data verglichen wird. Kannst du vielleicht mal ein Video machen in dem du die beiden Lösungen vergleichst? Das wäre toll. Vielen Dank und beste Grüße aus Berlin H.M. PS: Mach weiter mit dem tollen Content.
@VoodooBoot
@VoodooBoot 6 місяців тому
Your view’s body (or `previews`) in this case can be invoked more than once. In fact, during debugging, SwiftUI will call it twice. You should do your initialization in `.onAppear` or in `.task`.
@davidagyakwa288
@davidagyakwa288 2 роки тому
please also do core data and cloudkit too ....Its very confusing ...especially Ckzone
@jonathanpiette
@jonathanpiette 2 роки тому
Thank you for this great tuto! In this demo you import RealmSwift in all your Views requiring to use RealmObjects. Isn't it a way to avoid this by using neutral object to have an easy way to switch between storage provider (ex: Realm-CoreData) without having to refactor all the app?
@blubblurb
@blubblurb Рік тому
My humble opinion: Don't optimize code for might-be's, create your code for the actual usecase. When you switch to another data provider (it usually never happens), refactor it then.
@danielmcgee2447
@danielmcgee2447 Рік тому
How do you connect to realm atlas instead of local database?
@merakshot9277
@merakshot9277 Місяць тому
i'm using RalmDB for a simple Watchlist feature, creating watchlists, then add movies to the watchlist. the functionality is working, but when i build app, and try to add a movie to a certain watchlist, it crashes, saying (Thread 1: "Cannot modify List outside of a write transaction."). i have already created lists, and when i add i movie, onSheet appears then i select the list where i want to put the movie. but after i select the list, i get that error.
How to Make an App in 8 Days (2024) - Full Walkthrough
3:00:49
CodeWithChris
Переглядів 440 тис.
🐩🐕
00:25
Янчик
Переглядів 2,4 млн
Concurrency of SwiftData, by Donny Wals (English)
31:08
CocoaHeadsNL
Переглядів 1 тис.
iOS Core Data QuickStart Tutorial 2020
1:10:58
CodeWithChris
Переглядів 97 тис.
SwiftData Basics in 15 minutes
15:18
CodeWithChris
Переглядів 33 тис.
Big Tech AI Is A Lie
16:56
Tina Huang
Переглядів 46 тис.
I tried 5 Firebase alternatives
10:31
Fireship
Переглядів 736 тис.
Realm Database Tutorial for iOS
17:24
CodeWithChris
Переглядів 63 тис.