Reusable, Dynamic & Bindable Form In SwiftUI (Write A Clean & Reusable Form Component In SwiftUI)

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ม.ค. 2025

ความคิดเห็น • 21

  • @mayankbhaisora2699
    @mayankbhaisora2699 2 ปีที่แล้ว +1

    Man just came across your channel and your videos are easy to understand and well explained

    • @tundsdev
      @tundsdev  2 ปีที่แล้ว

      Thanks 👌🏾

  • @larschristiansen3136
    @larschristiansen3136 2 ปีที่แล้ว +1

    Got it. The whole video is brilliant. Thanks a lot.

    • @tundsdev
      @tundsdev  2 ปีที่แล้ว

      Glad you stuck through it, there is a method to the madness 😂👌🏾

  • @larschristiansen3136
    @larschristiansen3136 2 ปีที่แล้ว

    3:30 Why do you have two different Key enums in two different types. I seems to me that it goes against readability ?
    I'm only at the beginning at the video, so maybe good reasons come up.
    Tobefollowed...

    • @tundsdev
      @tundsdev  2 ปีที่แล้ว

      Keep on watching you’ll see why, its so we can give our section a key & our item its own key, this is why they’re extensions on FormSection & FormItem retrospectively 👌🏾 I don’t want to have a massive enum with loads of different keys mixed between the form item and form section

  • @binyang9831
    @binyang9831 2 ปีที่แล้ว

    Really nice video, if I want to use JSON to be source of true, so I need to replace the form manager to read the Joan, isn’t?

  • @Cricketingshorts786
    @Cricketingshorts786 ปีที่แล้ว

    Hello tunsdev good day. I would like to highlight the item is empty in form validation. can u pls help me out on this?

    • @tundsdev
      @tundsdev  ปีที่แล้ว

      Inside the validate function, you want to loop through the model and any of them that aint validate then change/set the items property to an error so its reflected on the UI 👍🏾

    • @Cricketingshorts786
      @Cricketingshorts786 ปีที่แล้ว

      @@tundsdev can u pls help me out with an example for loginform manager . really trying hard to acheived it

  • @DavidNitzscheBell
    @DavidNitzscheBell 2 ปีที่แล้ว

    Also, do you have a video or series that covers: creating a list of items (like you have here) and the ability to modify the items in the list? So, start with an empty list, click "+" to add a new complex item (with Strings, Dates, Enums, Bools, etc.) using the Form you have here, and when you click "Submit" it adds it to the list. Then, if you click on an item in the list, it shows the details for the time with an "Edit" button in the corner to allow you to modify it.
    I've been looking, but haven't found that, yet. Lots of "Todo List" applications, but it's not a list of Structs, but a list of Strings. No validation. No modification, except to mark as Done or Not Done.

    • @tundsdev
      @tundsdev  2 ปีที่แล้ว +1

      Not right now but i’m currently planning a todo list app course on my channel that works with CRUD operations, so it will involve doing what you’re describing here 👌🏾

    • @DavidNitzscheBell
      @DavidNitzscheBell 2 ปีที่แล้ว

      @@tundsdev oh great! looking forward to that.

  • @Niekroelofs
    @Niekroelofs 2 ปีที่แล้ว

    Hi is it possible that you didn't put this on your Github? I can't find it anywhere. If you have it online, could you send me the link?

    • @tundsdev
      @tundsdev  2 ปีที่แล้ว +1

      Here it is github.com/tunds/SwiftUI-sessions-beginners/tree/main/Bindable%20Forms%20In%20SwiftUI/TestProject

  • @DavidNitzscheBell
    @DavidNitzscheBell 2 ปีที่แล้ว

    why do you use the "na" case for your FormState? Isn't a form either valid or Invalid? you could just define the property to start with a default value of "invalid" and then switch it to valid when appropriate.

    • @tundsdev
      @tundsdev  2 ปีที่แล้ว

      I use ‘na’ since at that point the form technically isn’t valid or invalid when you load it up for the first time. It’s only when you perform an action which dictates what state it’s in, so i default to not available aka na. I just prefer to give forms some kind of value rather than giving it nil.

    • @DavidNitzscheBell
      @DavidNitzscheBell 2 ปีที่แล้ว +1

      OK, I see. Because you are using protocols, you may not want to validate all forms. Gotcha.

    • @tundsdev
      @tundsdev  2 ปีที่แล้ว

      Bingo this gives you the flexibility to choose what you want 👌🏾

  • @DavidNitzscheBell
    @DavidNitzscheBell 2 ปีที่แล้ว

    "formIsEmpty" - wouldn't that variable be better named as "formIsComplete" or "formIsNotEmpty" or "formIsValid"? The name you use is actually incorrect, it seems.

    • @tundsdev
      @tundsdev  2 ปีที่แล้ว +1

      Hmmm I have to disagree I don’t think it’s incorrect at all, the logic is to check if a value is empty. So i’m technically checking to see if the form has empty values hence why the variable is called formIsEmpty. FormIsValid would also be valid as the inverse, but at this point both of the variable can serve the same purpose, so to me it just comes across as being picky and doesn’t add too much value imo 😅😂