Save current user's portfolio to Core Data with MVVM | SwiftUI Crypto App #15

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

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

  • @KimbrellBrad
    @KimbrellBrad 3 года назад +3

    This was an awesome deep-dive into CoreData and like Scott below I am actually getting it and believe that I could take this project, use it as an example and create my own CoreData app! Very well done Nick!

  • @sols.2525
    @sols.2525 3 года назад +5

    Magical! Not only how the app works but your teachings. I am actually starting to think ahead of what you are about to do if that makes sense. Only thing I would change is I think the Edit Portfolio should follow the custom color themes as white looks a little out of place to me. Also the white checkmark on save. Maybe either follow the theme or turn it green.
    Off topic... Even though I don't understand everything because I am just an expert beginner, I think some of the changes/additions to SwiftUI/Xcode that is coming soon looks pretty awesome!

  • @oldschool84
    @oldschool84 6 месяцев назад +1

    Hi Nick, can you tell me the difference (advantages and disadvantages) between Core Data and SwiftData?

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

    I just skipped core data videos. I used array of dictionary and user defaults to store user holdings. I will dive core data later. Thanks for awesome videos

  • @ioannakarageorgou2483
    @ioannakarageorgou2483 7 месяцев назад

    Hello, really nice work!
    I was wondering if it would be better to show the checkmark after we validate that the save successed and not just after 2 seconds from the button click. Maybe we can also add error handling at this case

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

    awesome vid! I struggled with decimal separator because my decimal keypad uses "," instead of "." but i managed it!
    If you had similar problem:
    You have to use Double(quantityText.replacingOccurences(of: ",", with ".")) in 3 places:
    1 and 2: Within logic inside the SAVE BUTTON (opacity and creating an amount to save into Core Data)
    3: In getCurrentValue() where you are making a double of text from texfield

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

      could only be added in one place in the TextField:
      .onChange(of: quantityText) { newValue in
      quantityText = newValue.replacingOccurrences(of: ",", with: ".")
      }
      ...and placeholder shows the same - "Ex. 1.4"

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

    Hi Nick! Can’t say thank you enough for you’re dedication and great teaching skills. Thank you for this series, sensei.
    I have a couple of doubts.
    1. Shouldn’t you put the self.getPortfolio() (line 25 @22:26) call inside an else after the if statement? I’m asking because if there’s an error trying to load Core Data you will always try to get the portfolio even if an error occurred.
    2. I noticed that the row number of the coin portfolio list is not independent, it currently shows the row number assigned to the coin in the coin list. Shouldn’t show the coin portfolio list their rows numbering independently? In other words, start in 1 and increase as coins are added to the portfolio.
    3. I have a quality assurance (QA) profile and I’m concerned what can happen if you leave the Quantity text field empty and click the SAVE button. Wouldn’t it be more practical for the users to be able to remove a coin from their portfolio by just leaving this field empty instead of explicitly placing zero (0)?

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

      Hey Bryan! Great questions honestly. I will try to answer them the best I can...
      1. You can definitely do this. However, if the Core Data doesn't load, the getPortfolio() will fail anyway. So there isn't any difference really lol
      2. That could be a great UI! I left it as is, because I'd rather see the coin's market cap ranking than it's rank in my portfolio. But you're making your own version so that could be a cool alternative.
      3. That's a good recommendation haha. I don't think it would be hard to update the logic for that either!

  • @yasseraltamimi6171
    @yasseraltamimi6171 3 года назад +3

    Hello Nick, I just debugged the update function in the PortfolioDataService for about 3 hours and it just doesn't update the UI on the list when showing the list of portfolio coins. deleting works, adding works, but updating doesn't change the number of my holdings until I stop and restart the app which means that it's saved to core data but the update function is just not getting it updated even though I tried debugging in the map sink function and it shows the correct number which means that the portfoliocoins in the HomeViewModel is updating but for the life of me I can't figure out why the UI is not updating accordingly.

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

      Hi Yasser, It's hard to debug based on the comment. I would guess you mistyped something in the course. You can find the full source code on my github to compare code: github.com/SwiftfulThinking or join our Discord and post some code: discord.gg/vhKKyYTGDb

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

      @@SwiftfulThinking thanks a ton

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

      Hi. I have a same problem like you. Did you find a solution about it?

    • @МаксБарбарук-ф9ы
      @МаксБарбарук-ф9ы 2 года назад

      @@seunghyunkim6285 you could add manual Equatable to Coin to fix animation .none. Delete that and change animation to .animation(.none, value: selectedCoin?.id)

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

    Hi Nick, would this setup with a dataService and publisher/subscriber with SwiftData instead of CoreData?

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

    Hey Nick, thanks for the amazing playlist. I have a question:
    Why do you not using returning functions with for example CoreData, and instead call all the functions everytime you save?

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

    Nick, Hi there, love your content, very impressive teaching tecnics you have there. My friend i wanted to tell you about a problem, if you create a new holding, and after that you wanted to decrece it by -1... it get deleted...

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

    Hello my Portfolio view is not dismissing ... Any idea ? I am calling the XMarkButton where we defined an environment Object and called dismiss in the action closure of the button

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

    Hi Nick, like magic as always.

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

    Is there a plan to move this part of the course to SwiftData in the future?

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

    Spectacular video!

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

    Would you recommend having a folder with some Swift files that you can use over and over or is it better to just keep typing things out to not forget?

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

      I think having a folder or cheat sheet is fine as long as you actually understand the code you’re going to be copy and pasting 😂

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

    Can you explain how to add more than one transaction to the same currency?
    Because I couldn't figure out how to add with this many things

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

      Hi ibrahim! We didn't do that in this course but you can update your CoreData entity to save an array of data within it as well. Within the array you could include past transactions.

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

      @@SwiftfulThinking Thank you for yoru reply 🙏🏻

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

      @@SwiftfulThinking I didn't know hot to do it , can you explain to me how?

  • @offthedeepend762
    @offthedeepend762 Месяц назад

    We don't deserve you Nick 🙏