Create a Custom Dialog in SwiftUI

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

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

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

    Concise and informative. Love it. Thank you!

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

      Glad it was helpful! 🤗

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

    Super useful as usual. Thanks for the video Mike! 🙌

  • @jtbserviceeood
    @jtbserviceeood 3 месяца назад

    This video helped me a lot. Thanks.

    • @mikemikina
      @mikemikina  3 месяца назад

      You're very welcome! I'm glad the video was helpful!

  • @pqsk
    @pqsk 5 месяцев назад

    Great work man.

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

    Awesome!

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

    Pretty awesome tutorial. A couple of issues I have ran into though are,:
    The alert always appears when the view is first loaded, and cannot be re-shown once dismissed. Simply removing onAppear and replacing with onChange(of: isActive) and used an if statement fixed that.
    The other issue is that using ZStack does in fact allow me to click on the background to dismiss it, and even looks cool (by making everything else look inactive) but everything else IS inactive and remains inactive or un-clickable even after the popup is dismissed, and that issue I am still looking for a solution.

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

      Figured out a solution! I wrapped the Color portion just under ZStack in if (isActive) and that fixed the issue. Thank you again for the tutorial!

    • @mikemikina
      @mikemikina  9 месяцев назад +1

      That's awesome! I will be working on a new version soon. I will take your changes into consideration. Thanks! 🙌

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

    For anyone looking to use this on your views, another way is to just change the same view to a ViewModifier and show with a transition using modifier

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

      That's a good idea, thanks!

    • @KhanhQuang-ff2ve
      @KhanhQuang-ff2ve Год назад

      I tried it and it has a bug when I click Show popup multiple times and it doesn't show the dialog but only shows the background dialog@@mikemikina

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

      @@KhanhQuang-ff2ve good catch! This issue is being caused by the animation while changing the isActive. The easiest solution would be to disable the close for background tap gesture, or disable the animation for this case 👍

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

    Great video! One can simplify code for xmark (10:11) by using overlay with topTrailing alignment. This would eliminate VStack, HStack and Spacers.

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

      That's a great tip! I have just added it to the Github repo. Thanks! 🙌

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

    Nice 👍

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

    All this time I thought apple was using secret code to make those cute modal overlays. they were just hiding the views???

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

      Me too! Just learned this. My only concern would be memory issues.

    • @w0mblemania
      @w0mblemania 2 месяца назад

      @@grapejuice04 See my comment.