Build a SwiftUI to-do app from scratch with Realm Crash Course

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 83

  • @catulopsae
    @catulopsae Год назад

    Girl you Rock!!!! Awesome. I learned more from you in 42 minutes than from watching many hours of other videos. Thank you. Now it makes sense!!!!!!

  • @rayveenema4148
    @rayveenema4148 2 года назад +3

    This short but powerful tutorial has been a life saver as I struggled with the delete event that crashed my prototype and it never dawned on me to list the tasks (data) using the invalidated check.
    This tutorial is awesome and I now subscribed to your channel. :)

  • @patrickbarry4276
    @patrickbarry4276 Год назад +1

    Hi Steph, this is a really great tutorial. It has really helped me to create my own Apps. Keep up the great work, you are a star!!!

  • @ra9r
    @ra9r 2 года назад +11

    Using iOS 16 I am finding that the use of task.isInvalidated doesn't prevent a crash. In fact I get a warning in the editor that says that
    This property is defined on RLMEmbeddedObject, and may not be available in this context." Nothing I try seems to get around this bug. Any ideas what I could try? Everything else works as you have it.

    • @AnshSharma747
      @AnshSharma747 6 месяцев назад

      Swift package target 'Realm' is linked as a static library by 'Projectname' and 'Realm', but cannot be built dynamically because there is a package product with the same name.

  • @hongscave
    @hongscave Год назад

    It really is a crash course. Speedy and useful. Thank you very much.

  • @semilife
    @semilife 2 года назад +2

    Another great swiftUI tutorial Steph. Quick, to the point and informative to the end, and a fully functional app at the end in around 42 minutes, amazing! One request I would like to make is in the source if you could add comments to highlight what the code is doing, this would really help when looking back at the code again.

    • @DesignCodeTeam
      @DesignCodeTeam  2 года назад +2

      Glad it was helpful! Sure, I'll add comments in the source code! Thanks for your feedback!
      - Stephanie

  • @brunoguirra4531
    @brunoguirra4531 3 года назад +1

    This was my tutorial on Swift and I loved it!

  • @squirrelcup
    @squirrelcup 2 года назад

    thank you so much for your really great tutorial! i was looking for a good realm tutorial for beginners, and this is one of the best out there! THANK YOU!

  • @zanahid
    @zanahid 3 года назад +2

    Awesome. this will be tomorrow's task.

  • @fedak220
    @fedak220 2 года назад +1

    OMG...I was looking for the reason to crash the application after deleting the realm object for a month, thanks for the solution

  • @safesafe6922
    @safesafe6922 2 года назад

    It made me think about future, about learning SwiftUI

  • @jilanikashif
    @jilanikashif 2 года назад +1

    This is amazing and good explanation, we have made this in Swift, and wondering how easy it's to make in SwiftUI. Thanks for sharing valuable information

  • @pagal27
    @pagal27 Год назад +2

    Hi Stepahnie
    I believe there is an issue that started with iOS 16. Seems like when the realmManager deletes the object from the DB, the taskRow is not getting destroyed, which results in the below error:
    *** Terminating app due to uncaught exception 'RLMException', reason: 'Object has been deleted or invalidated.'
    terminating with uncaught exception of type NSException
    This is solved by using .onDelete with the ForEach block, but the Delete button is not customizable.
    Is there a way to get around the exception with SwipeActions, if not is there any way to customize the .onDelete block to show the trashcan symbol?

  • @prasoonrajpoot4077
    @prasoonrajpoot4077 2 года назад +4

    I learned a lot from this, thank you very much, App works like a charm on ios 15 but have you tried running the app on ios 16 , as on ios 16 the error you showed us on last part is not bieng solved by isInvalidated statement, please look into it, and find us a fix.

    • @VictorZima
      @VictorZima 2 года назад

      Anybody can help us with this problem?

    • @michalbarnat4153
      @michalbarnat4153 2 года назад +3

      You can omit this problem by not using .swipeActions on TaskRow in TaskView.
      1. delete swipeActions in TaskView.View
      2. Change TaskRow.View:
      - add 2 new properties :
      @EnvironmentObject var realmManager: RealmManager
      var forDelete: ObjectId?
      - to the HStack add:
      Image(systemName: "trash")
      .foregroundColor(.red)
      .onTapGesture {
      realmManager.deleteTask(withID: forDelete!)
      }
      - add to the preview :
      TaskRow(task: "Work", completed: true)
      .environmentObject(RealmManager())
      3. Now back to the TaskView.View and Your ForEach should looks like here :
      ForEach(realmManager.tasks, id: \.id) { task in
      if !task.isInvalidated {
      HStack {
      TaskRow(task: task.title, completed: task.completed, forDelete: task.id)
      .onTapGesture {
      realmManager.updateTask(withID: task.id, completed: !task.completed)
      }}}}

  • @indieshd
    @indieshd 3 года назад +4

    Wow! Thank you for this

  • @keremcanseker9745
    @keremcanseker9745 4 месяца назад +1

    I get an error due to conflict abt Realm package.
    Then i saw "Package Changed in version 10.49.3: Instead of adding both, only add one package." on mongoDB documentation.
    Solution is:
    project navigator -> targets -> build phases -> link binary with libraries.-> delete "Realm". There should be only "RealmSwift"

  • @ahermartin1
    @ahermartin1 2 года назад

    Fantastic, This tutorial is awesome and I now subscribed to your channel. :)

  • @coolcodingdad
    @coolcodingdad Год назад

    Great tutorial! thank you!

  • @otoS97
    @otoS97 2 года назад

    I loved swift UI. I hate setting constrains on storyboards. I tried to jump on sweet UI as soon as it was possible and tried to use it in production, but I took a huge L by doing it.
    What I overlooked was swift UI was only for IOS 13 and bigger versions. I was developing library and no big company took my library that had 13.0 as minimum version... I was forced to rewrite lib on UIViews.

  • @Prakashkumar-nl5cl
    @Prakashkumar-nl5cl 2 года назад +1

    Hi can you make a video on Expension panels/accordian in Swift , Uikit

  • @alessiopoggi547
    @alessiopoggi547 2 года назад +6

    I got this error whenever I try to delete a task, and the list contains more than one: "Terminating app due to uncaught exception 'RLMException', reason: 'Object has been deleted or invalidated.'"
    Do you know why?
    And on iOS 16 applying ".onAppear { ... }" to the List doesn't work, but the new statement ".scrollContentBackground(.hidden)" can help
    UPDATE:
    I added a "delete button" below every TaskRow and it works well, so the problem must be connected to the swipe action
    MY SOLUTION:
    I found a solution using ".onDelete" applied to forEach cycle instead of using ".swipeActions"

    • @НиколайКитов-ф5н
      @НиколайКитов-ф5н Год назад

      Can you send the code of your solution please
      it would help me a lot

    • @alessiopoggi547
      @alessiopoggi547 Год назад +7

      @@НиколайКитов-ф5н
      struct TasksView: View {
      @EnvironmentObject var realmManager: RealmManager
      var body: some View {
      VStack {
      Text("My tasks")
      .font(.title2).bold()
      .padding(.horizontal)
      .padding(.top)
      .frame(maxWidth: .infinity, alignment: .leading)
      if realmManager.tasks.count > 0 {
      List {
      ForEach(realmManager.tasks, id: \.id) { task in
      if !task.isInvalidated && !task.isFrozen {
      TaskRow(task: task.title, completed: task.completed)
      .onTapGesture {
      realmManager.updateTask(id: task.id, completed: !task.completed)
      }
      }
      }
      .onDelete { indexSet in
      indexSet.forEach { index in
      let taskTodelete = realmManager.tasks[index]
      realmManager.deleteTask(id: taskTodelete.id)
      }
      }
      .listRowSeparator(.hidden)
      }
      .scrollContentBackground(.hidden)
      }
      Spacer()
      }
      }
      }

    • @НиколайКитов-ф5н
      @НиколайКитов-ф5н Год назад +3

      @@alessiopoggi547 a huge human thank you
      from russia with love

    • @PossiblyFreddy2
      @PossiblyFreddy2 Год назад +1

      @@alessiopoggi547 This is amazing! Thank you! :D

  • @Filmreel1
    @Filmreel1 2 года назад

    It shows an error for me it says
    Value of type 'Task" has no member 'completed'

  • @jagdish_2326
    @jagdish_2326 2 года назад +1

    Great tutorial thank you
    Can you please create video for realm with multi thread environment.👍

  • @DanKardell
    @DanKardell 2 года назад

    Great job! Anychance you can make one using Storyboard vs SwiftUI? I have most of it, just want observe changes that happened to the DB in the background

  • @markhensonbautista8265
    @markhensonbautista8265 2 года назад +1

    Great tutorial!
    isInvalidated really worked well if there are multiple objects but getting an error when there is only one object to delete. Is there a solution for that?

  • @NekoNihongo
    @NekoNihongo Год назад

    how can I find more of your video, I love you, thanks a lot

  • @sebastianbo741
    @sebastianbo741 2 года назад

    Superb tutorial, do we get to the Sync & MongoDB part though?

    • @DesignCodeTeam
      @DesignCodeTeam  2 года назад

      Hi Sebastian! Unfortunately, this doesn't doesn't cover Sync & MongoDB, just the CRUD actions and saving the tasks locally. Maybe we'll create one in the future covering that!
      - Stephanie

  • @Nucl3aRxxx
    @Nucl3aRxxx 2 года назад

    Hello!
    thanks for great swiftUI tutorial!
    I'n new in swift/swiftui, help me pls, how to delete row with an animation? My app crashed with "objects deleted bla bla..."
    thank you very much

  • @vedantdhawal2044
    @vedantdhawal2044 Год назад

    I had an existing project I wanted to download this realm package to but it is stuck on loading screen is there any help I can get?

  • @ix901x
    @ix901x Год назад

    it will be create if we see new version of this video using Actor-Isolated Realms

  • @tridaynee
    @tridaynee 2 года назад +1

    amazing good job 👍

  • @kenturnbull9679
    @kenturnbull9679 2 года назад

    Is the instance of Realm that is created a shared instance (singleton) or are new ones created? If not how does realm handle shared instances?

  • @norcrowe
    @norcrowe 2 года назад

    Thank U So Much!

  • @10706BND
    @10706BND 3 года назад +1

    As someone who has been learning from your team, can I email someone to do a tutorial to expand this video? I have been struggling with a concept in mobile design that relates to a to-do application that I cannot find instruction on. I think because the concept is too hard, many people shy away. Is there an email?

    • @DesignCodeTeam
      @DesignCodeTeam  3 года назад

      Hi Brandon! We just got your email at support@designcode.io. We'll try to create a tutorial on creating multiple lists of tasks that in the future! Thanks for your suggestion!
      - Stephanie

  • @metinsaglam5027
    @metinsaglam5027 11 месяцев назад

    can we convert it to swift data or core data ?

  • @carmineloschiavo5864
    @carmineloschiavo5864 2 года назад +3

    Stephanie you R-O-C-K ! ❤️ 📱💻 ⌚️

  • @catulopsae
    @catulopsae Год назад

    I am still getting the error when deleting after adding the isInvalidated logic :(

    • @yahyagahbiche293
      @yahyagahbiche293 9 месяцев назад

      @@victorbrigido4815 I'm here looking for the same answer!

  • @СофьяЗахарова-о9ю
    @СофьяЗахарова-о9ю 2 года назад

    How did you paint the whole screen, it only paints safe area? Thanks :))

    • @DesignCodeTeam
      @DesignCodeTeam  2 года назад

      Hi, if the background color doesn't cover the entire screen, you can add the .edgesIgnoringSafeArea(.all) to cover the entire screen.
      - Stephanie

    • @СофьяЗахарова-о9ю
      @СофьяЗахарова-о9ю 2 года назад

      @@DesignCodeTeam Thank you:)

  • @Josivaphs
    @Josivaphs 2 года назад

    UAU Thank you so much

  • @jemmytech5474
    @jemmytech5474 2 года назад

    Thanks

  • @GiganticJetShell
    @GiganticJetShell 2 года назад

    How do you run on simulator instead of preview?
    There is an error when it tries to run on simulator:
    SwiftUI/EnvironmentObject.swift:70: Fatal error: No ObservableObject of type RealmManager found. A View.environmentObject(_:) for RealmManager may be missing as an ancestor of this view.
    It is the line where the ForEach starts in, specifically the realm.Manager.tasks

    • @DesignCodeTeam
      @DesignCodeTeam  2 года назад +1

      Hi JetShell,
      Make sure to add the @EnvironmentObject in each view (@EnvironmentObject var realmManager: RealmManager) and that you've added the environmentObject modifier (.environmentObject(realmManager)) to each instance of TasksView and AddTasksView in ContentView.
      You can head over to the Github repo to compare it with your code: github.com/stephdiep/ToDoApp
      - Stephanie

  •  Год назад

    thank you for your tutorial but your code ( also on github ) has a NSObject error. Please make sure commit your true code. Thanks anyway.

  • @MuhammadAli-im3jx
    @MuhammadAli-im3jx 2 года назад

    Hi thank you for the tutorial, I am having one issue though which is when I add the task nothing get’s added and it remains blank I was wondering what the issue might be

    • @michalbarnat4153
      @michalbarnat4153 2 года назад

      don't forget about init() in Your RealmManager and check syntax twice! ;)

  • @namngophuong6595
    @namngophuong6595 Год назад

    stephdiep... Is she from VietNam?

  • @vagabond4785
    @vagabond4785 2 года назад

    Hey, A small doubt. I am adding the task but it is not getting added in real time, only when i stop the preview and start again does the task appear. Could someone help me out with what the issue could be ?

    • @DesignCodeTeam
      @DesignCodeTeam  2 года назад

      Hi!
      Don't forget to call the getTasks() function every time you add, update or delete a task, so the tasks array is updated and them updated in real-time in your view. Also, make sure your tasks variable in the RealmManager is @Published!
      You can also take a look at the source code and compare it with your own: github.com/stephdiep/ToDoApp
      - Stephanie

    • @peterzhang6659
      @peterzhang6659 2 года назад

      @@DesignCodeTeam Hi I ran into the same problem, I checked with the source code and everything matches; however the view was not updated in real time whenever a new task is added, I'll have to either tap on another task to update its status or delete one to get the new tasks to show.

    • @victorbrigido4815
      @victorbrigido4815 10 месяцев назад

      @@peterzhang6659 Did you manage to resolve the error? I have the same problem

  • @PHILLIPSPHAM-dh9qo
    @PHILLIPSPHAM-dh9qo Год назад

    Stephanie Diep ❤Rock on

  • @otoS97
    @otoS97 2 года назад

    owww ain't you sweet ❤️

  • @luizzeduardo341
    @luizzeduardo341 2 года назад

    Are where the assets?

    • @DesignCodeTeam
      @DesignCodeTeam  2 года назад +1

      Hi! The source code can be found at github.com/stephdiep/ToDoApp
      - Stephanie

    • @luizzeduardo341
      @luizzeduardo341 2 года назад

      @@DesignCodeTeam Thank you

  • @codeHacker693
    @codeHacker693 2 года назад

    to be honest, you speak very fast without clear explanations.... I do prefer hacking swift more. Sorry.

    • @yahyagahbiche293
      @yahyagahbiche293 9 месяцев назад

      I noticed she does speak fast, and the typing is so fast on the screen that I'm struggling to keep up. Great tutorial though!

  • @artemcheck6332
    @artemcheck6332 2 года назад

    Hi, you are so beautiful woman 😍 do u have instagram?