SwiftUI Alerts - Buttons, TextFields, & Passing Errors

Sdílet
Vložit
  • čas přidán 26. 06. 2024
  • Go to squarespace.com/seanallen to save 10% off your first purchase of a website or domain using code SEANALLEN.
    In this video I show you how to display various types of alerts in SwiftUI. We discuss multiple buttons with destructive and cancel button roles and how to use a TextField in an alert. Then I show you how to pass an Error into your alert modifier so your alerts can be dynamic.
    My iOS Dev Courses:
    seanallen.teachable.com/
    My Source Code:
    seanallen.teachable.com/p/sou...
    X (Twitter):
    Sean Allen - / seanallen_dev
    Hired.com:
    hired.com/x/1n01g
    Book and learning recommendations that help out the channel if you decide to purchase (Affiliate Links):
    Mark Moeyken’s SwiftUI Books:
    www.bigmountainstudio.com/a/f...
    Paul Hudson's Hacking With Swift:
    gumroad.com/a/762098803
    RocketSim - Enhance Your Xcode Simulator:
    gumroad.com/a/51797971/ftvbh
    Objc.io Books (Thinking in SwiftUI & Advanced Swift):
    gumroad.com/a/656585843
    Timestamps:
    0:00 - Types of Alerts
    0:17 - Basic Alert
    3:13 - Multiple Buttons Alert
    4:55 - TextField in Alert
    7:23 - Passing an Error to an Alert
    10:26 - Dynamic UI based on Error
    #swift #softwaredeveloper #iosdeveloper
  • Věda a technologie

Komentáře • 17

  • @seanallen
    @seanallen  Před měsícem

    Learn more with my iOS Dev courses at seanallen.teachable.com

  • @joakimlundberg4139
    @joakimlundberg4139 Před měsícem +2

    Great tutorial, just what i was looking for

  • @sashlandia
    @sashlandia Před 25 dny

    Спасибо большое, что помогли разобраться с Alerts

  • @cfa532
    @cfa532 Před měsícem +1

    Exactly what I wanted to hear about🥳

  • @AveryNosen
    @AveryNosen Před měsícem +1

    Thanks Sean!!!

  • @nileshjdarji
    @nileshjdarji Před měsícem +2

    Also if you have only one button with role n your alert, you don’t need another button to show Cancel. You get Cancel for free.

  • @Jannemandevries
    @Jannemandevries Před měsícem +3

    What annoys me is that the alert buttons have a 400ms callback delay, while the closing animation is only 300ms. I managed to fix this (in UIKit), along with a couple of other quirks.

    • @seanallen
      @seanallen  Před měsícem +1

      I didn't know this. Thanks for sharing.

    • @dominikgrodl7822
      @dominikgrodl7822 Před měsícem

      Out of curiosity, when is that an issue? Is it just the aesthetics of it, or something else entirely?

    • @Jannemandevries
      @Jannemandevries Před měsícem

      @@dominikgrodl7822 If the callback code changes the ui it does it a bit too late imho making it feel sluggish. I'm close to a fix that also works on SwiftUI so stay tuned.

  • @JasonMitchellAZ
    @JasonMitchellAZ Před měsícem +1

    So easy.

    • @seanallen
      @seanallen  Před měsícem +2

      Love the new iOS 15 way of doing these.

  • @El_Batono
    @El_Batono Před měsícem +1

    thx, do more videos for creating ui components