Swift API Calls for Beginners (Networking) - Async Await & JSON

  Рет қаралды 93,003

Sean Allen

Sean Allen

Күн бұрын

Пікірлер: 176
@seanallen
@seanallen Жыл бұрын
Want to dive deeper into iOS development? Check out my iOS Dev courses (UIKit & SwiftUI) at seanallen.teachable.com
@abdulrb786
@abdulrb786 Жыл бұрын
Really informative. If possible could you create a playlist for different type of network calls that you have encountered example of which are, dependent n/w call, paginations etc. And best ways to call them, such as using dispatch group etc. that would really help the Developer across globe as all the developer do make n/w all the time.
@FriendlyNeighborhoodBlindKiid
@FriendlyNeighborhoodBlindKiid 9 ай бұрын
Is there any way that you can share a link to that file, especially because it's just a single file? I'm blind so I can't follow along with the video super well. I love how you explain the concepts, but there's a couple things with the symbols and stuff that I want to get my computer to read.
@parkerrex
@parkerrex Жыл бұрын
Coming from web world. Finally found a good creator for swift. Time to binge….
@seanallen
@seanallen Жыл бұрын
Welcome 👋. Hope you enjoy!
@pattmehta5835
@pattmehta5835 8 ай бұрын
bot 😂
@joeyeasterling149
@joeyeasterling149 3 ай бұрын
@@pattmehta5835found the bot
@manwithllama
@manwithllama Жыл бұрын
9:45 Sean! I love that you talk about being confused [as a beginner] by things being all over the place in different directories/files. That happens for me too. This type of "compassion" is rare. So many teachers just assume, and don't have the ability-or don't care to-reach back into the past and remember what it was like to start out. Keep doing this. It sets you apart as a teacher. A professional writer friend of mine-who used to have an excellent podcast-said this all the time: "You're not alone." He peppered it in his writing. And often started articles that way. It was his go-to. Why is this so important? Because ultimately people feel alone. [Most won't admit it.] We want to belong. To know *you* struggled at one point just like I am today? That makes me included. Like i'm not just some idiot that will never get this. It's empowering: "I got this." Thanks again. Love learning from you (and @twostraws).
@SHOLINGER
@SHOLINGER 8 ай бұрын
bro your twitter handle ? and that comment was very nice of you !
@iLoveAppl3947
@iLoveAppl3947 8 ай бұрын
yeah i have watched 20+ videos about this topic and yet this is the only video that worked for me. Thanks bud
@seanallen
@seanallen 8 ай бұрын
I was the same way when I tried learning network calls. It's a tough topic. Happy to hear my video resonated with ya!
@meunomeecriss
@meunomeecriss 28 күн бұрын
Duuuuude, you make it so simple. I am scared bc you told in the beginning of the video that it is NOT EASY AT ALL. Thanks for this explanation.
@thanasisathanasi4965
@thanasisathanasi4965 10 ай бұрын
I am mostly a web developer using Javascript, PHP, MySQL and Apache server and I developed my own framework using these tools. I have decided to expand my framework to handshake with Swift and Kotlin ecosystems so I can develop apps that communicate with my other framwork! This video was my starting point. !! Thanks
@jaylensmith6308
@jaylensmith6308 Жыл бұрын
I’m moving away from completion-type networks calls and I am happy that this video is out
@seanallen
@seanallen Жыл бұрын
Happy to help with this transition.
@GouravSinghalMusiTech
@GouravSinghalMusiTech 10 ай бұрын
You should keep making videos... it should be a request from whole iOS community! Kudos to you!
@ArthasFede
@ArthasFede 9 ай бұрын
Simple, quick and streigth to the point. Love this tutorial!! Thanks Sean! 🙏🏻
@seanallen
@seanallen 9 ай бұрын
Glad you liked it!
@mingy7017
@mingy7017 Жыл бұрын
Thank you SO MUCH Sean this goes straight to the point and very informative and easy to follow the logic behind. Very very well conveyed! ❤
@seanallen
@seanallen Жыл бұрын
Thanks Ming! Glad you liked it.
@AlexZolotov-h3j
@AlexZolotov-h3j 9 ай бұрын
Nice! Very detailed explanation. I am a seasoned software engineer just getting my hands dirty with Swift, and all of these concepts make a lot of sense to me. Thanks.
@seanallen
@seanallen 9 ай бұрын
Glad it was helpful!
@TheNicolas721
@TheNicolas721 2 ай бұрын
man you are just the goat of swift tutorials, I've learned a lot from you, thanks a lot!!
@seanallen
@seanallen 2 ай бұрын
I appreciate that! Glad you like it.
@tharindudarshana6480
@tharindudarshana6480 Жыл бұрын
Thank you ! I'm learning swift as an experienced Spring/Java developer and your tutorials help me to grab the fundaments of Swift with actual functionality which is interesting to follow. Simply great & please keep up posting
@seanallen
@seanallen Жыл бұрын
Glad you like them!
@mario_luis_dev
@mario_luis_dev Жыл бұрын
I’m on the same boat as you! Spring -> Swift. Really digging everything about Swift development so far, I only wish I had jumped into this sooner!
@cheeesecake6989
@cheeesecake6989 Жыл бұрын
Thanks so much. It is true - for a beginner having all the code in one place makes it easier to understand.
@sebasy10
@sebasy10 6 ай бұрын
Im taking the course of angela, basics of swift. And i look up for your videos to have a certain idea of what im going to see so im not fully lost haha. Thanks for sharing your knowledge
@seanallen
@seanallen 6 ай бұрын
Happy to help!
@davidcbeaudoin
@davidcbeaudoin Жыл бұрын
I've been doing Apps with network requests for a while, but I haven't messed around with using async await yet. This lesson will be really useful for trying to apply it in a new App I'm building. Thank you for a clear explanation as always!
@seanallen
@seanallen Жыл бұрын
Glad you liked it, David!
@rodrigorgpsk8
@rodrigorgpsk8 5 ай бұрын
What an amazing video! With that I did make a small app with navigation views to check bio and followers in order to get more expertises about async api calls and screen navigations! Thanks Sean! Keep doing these awesome videos! 😎
@bleulejour
@bleulejour Жыл бұрын
Best tutorial ever for Networking and API calls in Swift UI!
@rmessentials4048
@rmessentials4048 9 ай бұрын
This is a nice and inspiring tutorial. Thanks for the video SeanAllen I will definitely watch it again.
@seanallen
@seanallen 9 ай бұрын
Glad it was helpful!
Жыл бұрын
Thank you so much. I didn't know that we can also use async await keywords on Swift and on networking. I was doing my all networking codes with dataTask. It gave me a new perspective. Also It's nice to see Paul here too.
@seanallen
@seanallen Жыл бұрын
Happy to show you something new!
@billblair3155
@billblair3155 4 ай бұрын
Good stuff Sean. Thanks much! One of the best presentations I've seen. And I've seen a lot. Thx again.
@seanallen
@seanallen 3 ай бұрын
Glad it was helpful!
@WestCoastAce27
@WestCoastAce27 Жыл бұрын
Great job. So much easier than the Obj-C. If you haven’t, since you brought it up, you might do a pros/cons video on multiple files. I’m sure there are going to be many opinions on ‘how big is too big’ for 1 file.
@ash_9651
@ash_9651 Жыл бұрын
sean thank you soooo much, this cleared up a lot for me. i love how you progessivly recap the code it really helps me understand!
@seanallen
@seanallen Жыл бұрын
Glad it helped!
@MassonLifestyle
@MassonLifestyle 8 ай бұрын
Great video. I suspect I will be saving this and watching it a couple of times. Thanks!
@seanallen
@seanallen 8 ай бұрын
Glad it was helpful!
@ДенисАвраменко-з9ю
@ДенисАвраменко-з9ю Жыл бұрын
Hello from Ukraine. Nice stuff! Thanks a lot for sharing your knowledge and wisdom! Keep it going! You are great!
@seanallen
@seanallen Жыл бұрын
Glad you enjoyed it!
@KalDillard
@KalDillard Жыл бұрын
Thank you! I started out learning iOS until I went to Flutter! I’m looking to learn more Native iOS and you made this easy for me. This is pretty similar to making network calls in Flutter.
@dineshdas9983
@dineshdas9983 Жыл бұрын
What a video🤩 , Im very much happy to watch this video, 25 minutes goes like a minute great tutor i ever had
@seanallen
@seanallen Жыл бұрын
Glad you enjoyed it!
@ouadiae2706
@ouadiae2706 Жыл бұрын
i was looking for something like this for ages, thank you
@seanallen
@seanallen Жыл бұрын
Happy to help!
@mranjithamranjitha6724
@mranjithamranjitha6724 10 ай бұрын
Ur notes&teaching is very clearly... thank u
@NathanBudd
@NathanBudd 10 ай бұрын
This is a very well explained video. Do you have one that includes auth and how to save tokens using SwiftUI? Either in a video, or one of your courses?
@seanallen
@seanallen 10 ай бұрын
Thanks. Glad you liked it! I don't have a video or course that covers saving tokens, unfortunately.
@patgoo2
@patgoo2 Жыл бұрын
Very good training video and an important training video to watch. I like how you demonstrate network calls and syncing the API data, coding the JSON, and creating a starter page all on one Xcode file. This makes it much easier to follow.
@seanallen
@seanallen Жыл бұрын
Glad it was helpful, Pat!
@AngleIron426
@AngleIron426 Жыл бұрын
I coded along and it worked beautifully! Learned a lot. Wonderful introduction to async and URL session. Thank you!
@edwardhasted3849
@edwardhasted3849 Жыл бұрын
Many thanks for tackling the real world example that is the most likely bottle neck for Async Await in a workable entirety.
@seanallen
@seanallen Жыл бұрын
Happy to help!
@samr.4692
@samr.4692 Жыл бұрын
Great video. Covered multiple subtle but important topics. Thank you.
@seanallen
@seanallen Жыл бұрын
Glad it was helpful!
@SB-jq4jc
@SB-jq4jc Жыл бұрын
You explained this so well! Thank you for this!
@seanallen
@seanallen Жыл бұрын
Glad it was helpful!
@saeedebrahimpour-uz4uf
@saeedebrahimpour-uz4uf 2 ай бұрын
you are a really really good teacher,keep going man ,love you from iran😍
@СергейБезногов-т6у
@СергейБезногов-т6у Жыл бұрын
It's the best video about network calls !!!
@seanallen
@seanallen Жыл бұрын
Glad you liked it!
@justmytraining4190
@justmytraining4190 2 ай бұрын
hi! my English is so bad, but your videos i can understand very easy. Thank you!
@seanallen
@seanallen 2 ай бұрын
Happy to hear that!
@antoniovuono4521
@antoniovuono4521 5 ай бұрын
The best tutorial i already see ! very usefull, thanks dude !
@CostyaT
@CostyaT Жыл бұрын
My first time watching your videos with 29 comments. Thanks for new video 😅.
@seanallen
@seanallen Жыл бұрын
Thanks for watching :)
@FranciscoHernandez-ij3kd
@FranciscoHernandez-ij3kd 8 ай бұрын
Thank you Sean, I appreciate your work.
@seanallen
@seanallen 8 ай бұрын
My pleasure!
@mr.sergio8773
@mr.sergio8773 Жыл бұрын
Thank you for the video. I would like to know more about Network Calls. How to work with an array of users?
@Moch117
@Moch117 7 ай бұрын
Hey Sean, where do you make the API calls ? It seems like a lot of tutorials online show it in the view model but others say to make the call in the Model layer.. This is for MVVM architecture
@kal5211
@kal5211 Жыл бұрын
Excellent tutorial! Thanks Sean.
@seanallen
@seanallen Жыл бұрын
Glad it was helpful!
@Internet.Surfer.No.1
@Internet.Surfer.No.1 3 күн бұрын
Thanks for great video. would be nice if you also make a video for real world use-case, basically the next step of this, where we are doing it more declarative, using ObservableObject. thanks
@wilsonwu5663
@wilsonwu5663 Ай бұрын
hi, wondering which terminal should I use to get the Githubuser data? the terminal on Mac or somewhere else from Github? thanks,
@alinusari2033
@alinusari2033 6 ай бұрын
Thanks so much. It worked, but How can I edited for an array json data?
@omerklbkr
@omerklbkr Жыл бұрын
I was waiting for the second API call with Array json. Do u gonna make it ?
@ivanmatkovic
@ivanmatkovic Жыл бұрын
Excellent content. Truth be told, I'm not a huge fan of excessive do { } catch blocks as they tend to make me anxious for some reason 😅. I usually lean towards using closures or creating wrappers around do/catch, maybe it's just a force of habit. However, each new release of Swift & SwiftUI seems to be improving tremendously. I'm optimistic that they'll soon address the navigation issues - I'm aware of NavigationStack, but sadly it's only compatible with iOS16+ and I haven't had the chance to try it out yet. A minor suggestion for this kind of videos would be to include a gist with a code in the description.
@muhammednadeemma3553
@muhammednadeemma3553 Жыл бұрын
Hi Sean, Out of subject can we create an xcframework with third-party dependencies like Alamofire, lottie-ios etc..
@moku7787
@moku7787 8 ай бұрын
hi i want to ask something, i already have APIService, model data and already call API like image, text to UI but i need to call link from API with hyperlink text. like example a text (Read more) clickable but the link from API, how to call it?
@ccstreams7706
@ccstreams7706 9 ай бұрын
i get so many errors in swift since it works so differantly from other programming languages. what is the best method to debug? for example when a FOREACH accepts arrays and i where to print that 0..
@hustlerking4295
@hustlerking4295 Жыл бұрын
Thank you! Thank you! Thank you! Very helpful video! Much wanted!
@khaled-kl2dc
@khaled-kl2dc Ай бұрын
Can you help me with something that may be easy for you but difficult for me? I have been unable to solve this problem, which is, in short, I created my game project on Unity, then built the application on apk, it works without problems, then built it on ios, but when running the application on testflight or xcode, the application does not reach the server, and we are using (AWS), and this error appears in the run log: Networking process (0x138004a10) took 1.482501 seconds to launch. Do you know a solution to the problem or have you made an explanation about it?
@andreim7808
@andreim7808 Жыл бұрын
Hi Sean! What are your thoughts on iOS development vs QA automation? Any ideas what the future holds for iOS developers for 2024 job market is US considering all the recent massive layoffs in the big tech? Trying to make a decision here, as I think QA market is over saturated at this point... Thanks!
@JRHague
@JRHague Жыл бұрын
I would like to see how people typically handle tests with network calls. Would there be test to see if the api your calling has changed and would you make a dummy service that mimics the api for your own tests?
@TheWealthyIdiots
@TheWealthyIdiots Жыл бұрын
Great video! How would you handle passing request states like “loading” back to the UI? This variable will change a couple of times during the process so you couldn’t just pass it back as a return from your request, so just curious how you would handle it.
@TheWealthyIdiots
@TheWealthyIdiots Жыл бұрын
I guess you could just add it before and after the await call 🤔. That would work I think.
@seanallen
@seanallen Жыл бұрын
Yeah, that's how it's typically handled. I usually use something like an "isLoading" boolean that gets flipped to true right before the API call, and then flipped back to false when the API call returns.
@TheWealthyIdiots
@TheWealthyIdiots Жыл бұрын
@@seanallen I ended up doing this and adding a activity progress view to my button. It came out great! Thank you!
@Olden2610
@Olden2610 Жыл бұрын
Hey Sean, great video as always! As an experienced developer wanna ask you - do you think it's okay to use classic Result in closure way of network request instead of async/await in new UIKit based apps? I tried to use async/aways and it didn't feel much better, still need to wrap this code in Task, call it with and expect response asynchronously. What do you think? Due to i currently making new app from scratch, and still feeling unease cause i use UIKit :D And not using async/await is making me feel like those ObjC devs i was looking at when i started iOS 5 years ago
@seanallen
@seanallen Жыл бұрын
My opinion is that it's perfectly fine to use the classic closure based way of doing network calls. Async/Await has its benefits and is more "modern". But at the end of the day... as long as your code works and the codebase is easy to read and work in.. you're all good as far as I'm concerned.
@absar66
@absar66 Жыл бұрын
Great refresher..Thanks Allen
@seanallen
@seanallen Жыл бұрын
Happy to help.
@ssaai
@ssaai Жыл бұрын
please make video about access and refresh token, Where to save in the iOS, how to call the api
@crackedpistachio6001
@crackedpistachio6001 11 ай бұрын
You are a legend man
@seanallen
@seanallen 11 ай бұрын
Haha, happy to help :)
@umairnazim3565
@umairnazim3565 7 ай бұрын
Amazing explanation
@seanallen
@seanallen 7 ай бұрын
Glad you liked it
@alexsalinas2733
@alexsalinas2733 9 ай бұрын
Amazing content, was able to follow along and replicate the code. Would greatly appreciate it if there is a follow up video regarding oauth API calls to fetch and refresh access token, thanks again for the great content.
@Bobin13
@Bobin13 11 ай бұрын
OG video, Thanks for the help.
@seanallen
@seanallen 11 ай бұрын
No problem!
@taylorenglish6237
@taylorenglish6237 7 ай бұрын
Thank you for the clear video!!
@seanallen
@seanallen 7 ай бұрын
Happy to help!
@thomasfrank8379
@thomasfrank8379 Жыл бұрын
Do you know how to get the redirect url when getting status code 301? I need to add query items to the new url. Thanks :)
@mkb18577
@mkb18577 8 ай бұрын
I tried to recreate this exactly as done in the video to test myself. I can only get it to show the placeholders. It won't pull up any user info? Any ideas why?
@marinab.6647
@marinab.6647 5 ай бұрын
omg this worked!!! thank you!
@seanallen
@seanallen 5 ай бұрын
You're welcome!
@killua3939
@killua3939 Жыл бұрын
Been unemployed for 2 months and been actively looking for Swift / React native jobs but the demand is so small this year because of the no-to-low code app builders. its really frustrating pursuing ios beyond.
@nexj4904
@nexj4904 9 ай бұрын
What is the best way to handle null responses from the server? my bio was null and it failed to parse the data.
@ericka.montanez6821
@ericka.montanez6821 10 ай бұрын
Fantastic explanation.
@fattoofittoo7907
@fattoofittoo7907 Жыл бұрын
how to fix "Function declares an opaque return type, but has no return statements in its body from which to infer an underlying type" i create exactly like video but got this one error, already google it cant really found the solution.
@DivyanshArya-bc2dx
@DivyanshArya-bc2dx 5 ай бұрын
As an flutter developer swift is amazing
@vazzhh
@vazzhh Жыл бұрын
its ok. I understand. but i try to use a JSON from Woocommerce. ( products, price, description ) but not working. i dont know whats the problem
@eldarkulic4834
@eldarkulic4834 5 ай бұрын
maybe it's what he mentioned on the start (auth)? did you solved your problem?
@jkeee
@jkeee Жыл бұрын
Thank you man, you are the bestest
@DavidShaw-dc4re
@DavidShaw-dc4re Жыл бұрын
It fails for me and I get invalid data error code., but a return of 1385 bytes My raw data has twostraws's data response, i can read clearly but my code fails EDIT: The problem was my struct GitHubUser had avatar_url rather than avatarUrl
@4bctrujillog1112
@4bctrujillog1112 Жыл бұрын
Hi! I really like your videos! You are my iOS university so thanks. Could you make a video about the same thing but using Alamofire? Thank you.
@seanallen
@seanallen Жыл бұрын
Glad you like my content! I haven't used Alamofire since 2016. Unfortunately, I'm not familiar with it anymore.
@4bctrujillog1112
@4bctrujillog1112 Жыл бұрын
@@seanallen don’t worry Sean! Thank you so much for responding to me. Never stop please, I’m from Spain but you are literally the best teacher.
@cylenunemaker2444
@cylenunemaker2444 5 ай бұрын
fantastic video
@seanallen
@seanallen 5 ай бұрын
Thank you! 😃
@TDC-BK
@TDC-BK Жыл бұрын
My guy 💪🏿
@LazarofShalev
@LazarofShalev Жыл бұрын
thank you sean!
@AvantjerTube
@AvantjerTube Жыл бұрын
Thanks, Sean 🙏
@seanallen
@seanallen Жыл бұрын
No problem, Jerry.
@AvantjerTube
@AvantjerTube Жыл бұрын
FYI... When I tried using my own account url, ending in "avantjer", the app was showing only placeholders for all three fields (but no errors). I discovered that I had no "bio" on GitHub. ("bio": null) Once I added a bio to my GitHub account, everything worked fine. Interesting that I wasn't at least shown my login, and avatar, even though I had no bio. Maybe Codable "silently" failed because "bio" was null?
@AvantjerTube
@AvantjerTube Жыл бұрын
The code can be updated to handle cases in which the user has no bio. Just make "bio" an optional struct GitHubUser: Codable { let login: String let avatarUrl: String let bio: String? }
@AbdeliOS
@AbdeliOS Жыл бұрын
This is a gold one!
@seanallen
@seanallen Жыл бұрын
Glad you enjoyed it, Abdel!
@BeyzilMusics
@BeyzilMusics Жыл бұрын
My brain hurts, thanks for the video!
@seanallen
@seanallen Жыл бұрын
You're welcome
@DarylMarcano
@DarylMarcano 7 ай бұрын
how can i use this for an array of users?
@airysm
@airysm Жыл бұрын
Could async await be used with uikit too?
@joshuascorca550
@joshuascorca550 Жыл бұрын
Hi Sean, Thanks for the video! Question: Why don't you need to wrap this line in a "do catch" ? let (data, response) = try await URLSession.shared.data(from:url)
@filipecanzi
@filipecanzi Жыл бұрын
Thanks Sean!!
@MegaOlzo
@MegaOlzo Жыл бұрын
Thank you!
@seanallen
@seanallen Жыл бұрын
You bet!
@hamzahimi1681
@hamzahimi1681 Жыл бұрын
is there any difference between doing in swift ui or core swift
@seanallen
@seanallen Жыл бұрын
SwiftUI is a user interface framework. Swift is a programming language.
@vanylaskywalker
@vanylaskywalker Жыл бұрын
How would you persist the downloaded JSON data using SwiftData?
@seanallen
@seanallen Жыл бұрын
I haven't worked with SwiftData yet, but this is a larger topic that would require another video. Can't be answered in a comment.
@bosch5053
@bosch5053 Жыл бұрын
Helpful!
@АлишерРизабаев-ш8ж
@АлишерРизабаев-ш8ж Жыл бұрын
The best of the best .....:)
@seanallen
@seanallen Жыл бұрын
Thanks for the kind words :)
@mirzausama7458
@mirzausama7458 Жыл бұрын
Great sir please make more video on api using uikit
@victorriurean
@victorriurean Жыл бұрын
🔥
@danyjamous5986
@danyjamous5986 8 ай бұрын
Does someone know why is try not in a docatch block at : 12:09
@gjermundification
@gjermundification Жыл бұрын
Maybe I'll start playing with async await now.
@seanallen
@seanallen Жыл бұрын
Let me know what you think!
@ChrisAyeko
@ChrisAyeko 8 ай бұрын
cool video)
@seanallen
@seanallen 8 ай бұрын
Glad you liked it!
@shippoboston7974
@shippoboston7974 Жыл бұрын
Literally I watch your videos the past week and realized I wasn't subscribed. Shame on me!
@soheilpakgohar6630
@soheilpakgohar6630 6 ай бұрын
awesome
@seanallen
@seanallen 6 ай бұрын
Glad it was helpful!
Swift Generics for Beginners - Eliminate Code Duplication
10:37
Sean Allen
Рет қаралды 20 М.
Swift Closures Explained
14:23
Sean Allen
Рет қаралды 66 М.
Это было очень близко...
00:10
Аришнев
Рет қаралды 3,7 МЛН
This mother's baby is too unreliable.
00:13
FUNNY XIAOTING 666
Рет қаралды 39 МЛН
버블티로 부자 구별하는법4
00:11
진영민yeongmin
Рет қаралды 20 МЛН
1 сквиш тебе или 2 другому? 😌 #шортс #виола
00:36
40 APIs Every Developer Should Use (in 12 minutes)
12:23
Coding with Lewis
Рет қаралды 377 М.
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
I learned to code from scratch in 1 year. Here's how.
41:55
Thomas Frank
Рет қаралды 418 М.
Swift Optionals - How to Unwrap (real examples)
14:20
Sean Allen
Рет қаралды 13 М.
Learn the Essentials of Swift in one hour
58:14
Paul Hudson
Рет қаралды 195 М.
How To Work With Any API (API Tutorial using URL Requests)
27:07
CodeWithChris
Рет қаралды 125 М.
iOS Dev Job Interview - Must Know Topics
2:27:40
Sean Allen
Рет қаралды 86 М.
Это было очень близко...
00:10
Аришнев
Рет қаралды 3,7 МЛН