Swift 5.5: Async Await Operations (Xcode 13, iOS 15, 2022) - iOS for Beginners

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

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

  • @difanaufalpratama8765
    @difanaufalpratama8765 3 ปีที่แล้ว +1

    Man that so fast, it doesn't take a week and you already make tutorial for new features. Keep going bro!

    • @iOSAcademy
      @iOSAcademy  3 ปีที่แล้ว

      Thanks, will do!

  • @glennadams7047
    @glennadams7047 3 ปีที่แล้ว +10

    Nice. I think a whole series of tutorials on this is needed, with simple to complex use cases. I would buy the course if you made one :)

    • @iOSAcademy
      @iOSAcademy  3 ปีที่แล้ว +3

      Coming soon!

    • @glennadams7047
      @glennadams7047 3 ปีที่แล้ว

      @@iOSAcademy And include all the nested network calls . like populating a table view with users, their photos, etc all separate calls, proper error handling , etc. all the pain-in-the-ass stuff. Just my $.02. regards and keep up the great work

    • @jineshdoshi
      @jineshdoshi 3 ปีที่แล้ว

      @@iOSAcademy any ETA on this?

  • @flamboulder
    @flamboulder 2 ปีที่แล้ว +3

    These videos are absolutely outstanding summaries thank you 🙏

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

    You saved my life.

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

    Great! simply great, thanks!!

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

      You’re welcome

  • @karlostj4683
    @karlostj4683 2 ปีที่แล้ว +3

    Some imminent deprecation on the "async { ... }" call. Need to change it (going forward) to "Task { ... } "

  • @jerseycafe9099
    @jerseycafe9099 3 ปีที่แล้ว +1

    good job! thanks mate!

  • @fermatslasttheorem6298
    @fermatslasttheorem6298 2 ปีที่แล้ว +4

    Great video. I'm a senior iOS engineer but trying to catch up on some APIs I've been lazy to learn.

  • @janarthanank877
    @janarthanank877 3 ปีที่แล้ว +1

    Easy to understand 👏🏻

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

    Beautiful video. Bravo!

  • @3909630
    @3909630 3 ปีที่แล้ว +2

    yeah ima call you professor iOS now

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

    async {} is now Task.init(operation: {})

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

      Or just "Task { }" - which is the same thing. You don't have to use init and the only argument can be done with a trailing closure.

  • @josejimenez7502
    @josejimenez7502 3 ปีที่แล้ว

    They are making it easy.

  • @DhruvilPatel
    @DhruvilPatel 3 ปีที่แล้ว +2

    Simple and clear, thanks mate!

  • @okolo_food
    @okolo_food 3 ปีที่แล้ว +1

    Nice, looking forward to some practice about it

  • @prithvi_acoustic
    @prithvi_acoustic 3 ปีที่แล้ว

    Thank you for the great explanation

  • @TheBooban
    @TheBooban 3 ปีที่แล้ว +1

    The syntax is much better, it makes sense. completion handlers didn't make sense as they are part of the function parameters but when you call them, the closure is outside the params ().

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

      Well, no they don't have to be at all. You can certainly put a closure inside the function parenthesis. What you are talking about is a trailing closure syntax, which is only if you have a closure that is the last argument of the function. You don't have to use trailing closure syntax if you don't want to.

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

    Really good video, thanks for sharing that. It was concise and easy to understand.

  • @franciscoarciganolasco6027
    @franciscoarciganolasco6027 10 หลายเดือนก่อน

    if use Task what would happen?

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

    I wish these tutorials were done in SwiftUI, much cleaner, and much faster. Instead of spending like 8 minutes setting up the project due to UIkit nonsense, just add List (user) and be done.

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

    can you or someone please tell me what is the different of the tableview variable you wrote that looks the same as lazy variable definition, but without the lazy keyword.
    is it behave like lazy? is this variable create only once and only when someone access to it?
    at 03:55

  • @RahulVerma-tv6gq
    @RahulVerma-tv6gq 2 ปีที่แล้ว

    But what if we are using alamofire which returns a Result type data, from which it’s not possible to return data as we can’t return anything inside cases of result, how to handle that any help would be appreciated.

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

    Is concurrency is async?

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

    Thanks for the content, btw which theme in Xcode do you use?

  • @hakankumdakc9233
    @hakankumdakc9233 3 ปีที่แล้ว +1

    how did you do that without adding import _Concurrency? I get error about couldn't found async. Also imported concurrency but couldn't found that module.

    • @iOSAcademy
      @iOSAcademy  3 ปีที่แล้ว +1

      It should work in xcode 13

  • @TheBooban
    @TheBooban 3 ปีที่แล้ว +1

    so is @escaping completion handlers obsolete now?

    • @iOSAcademy
      @iOSAcademy  3 ปีที่แล้ว

      No. Both are still valid

    • @Martin-xj8rp
      @Martin-xj8rp 3 ปีที่แล้ว

      @@iOSAcademy but its possible to replace the completion Blocks with it, right?

  • @lyphuc4362
    @lyphuc4362 3 ปีที่แล้ว +3

    from javascript

    • @MrPerucan
      @MrPerucan 3 ปีที่แล้ว

      Literally lol

    • @iOSAcademy
      @iOSAcademy  3 ปีที่แล้ว

      Yep!

    • @glennadams7047
      @glennadams7047 3 ปีที่แล้ว +1

      I know right ? What took so long ??? Apple is a $2T company.

  • @souallei
    @souallei 3 ปีที่แล้ว

    Async await it's pretty cool and very simple ❤️. Thank you for u tutorial sir. Please, if is possible, make a tutorial about repository sir. 😁

  • @TheSpiralnotizblock
    @TheSpiralnotizblock 3 ปีที่แล้ว

    Do you have a video on how to use a REST API with Swift?

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

    We all know async calls do not block execution until the async operation is completed.
    With await being introduced are we still doing that or are we waiting on the async operation being completed?

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

      Waiting

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

      @@iOSAcademy Got it. So anything that we do NOT want to wait for async call should be outside the "Task" block?

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

    Bad quality of the video. Please fix this. You hurt our eyes. Besides that, thanks for the content. It's very helpful.

  • @aliquewilliams3080
    @aliquewilliams3080 3 ปีที่แล้ว

    You wasted almost half the video setting up the project before showing the concept. Next time, have the project already prepared.

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

    I think the weak self attempt was correct.
    async { [weak self] in
    guard let _self = self else {
    return
    }
    let users = await fetchUsers()
    _self.users = users
    DispatchQueue.main.async {
    _self.tableView.reloadData()
    }
    }
    🙃

  • @maqusss
    @maqusss 3 ปีที่แล้ว

    setting users property in 8:54 should also happen on main thread. Does "async" in line 31 dispatch closure on current thread? that would make DispatchQueue.main.asynch from line 35 unneccesary.

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

      AFAIK you can perfectly do that on non-main threads. Only updating the UI (like reloading the table view) needs to be on the main thread.

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

      @@MrLinusunil You can if you use some kind of synchronization.
      Otherwise you have potential data race or inconsistent state because two threads are accessing the same property, one changing it.
      For example: property is read on main thread in table view data source method numberOfRows,
      then propeerty is changed on non-main thread before cellForRowAt call, then you have crash "index out of range".