Check Internet Connection in App (Swift 5, Xcode 12, Wifi) - iOS Development

  Рет қаралды 23,437

iOS Academy

iOS Academy

3 жыл бұрын

In this video we will explore how to check for internet connection in your app. We will also look at checking the current connection type to better allow you to build great user experiences. As always we will be working in Swift 5 and Xcode 12. Leveraging the Network framework and NWPathMonitor, we'll learn this fundamental concept every app developer needs to know.
💻 Source Code: / iosacademy
🎥 Subscribe for more: kzfaq.info?su...
😎 Like my teaching style? Check out some of my most popular courses! courses.iosacademy.io
#swift #network #iOSDeveloper
Join this channel to get access to perks, code, groups, and more:
/ @iosacademy
Join the iOS Academy Community: iosacademy.io/
** Get Skillshare free for 2 Months and learn iOS
www.skillshare.com/r/user/afraz
** Manage all your investments from app earnings on Betterment!
bit.ly/3eBwlI9
** Grow your own KZfaq tech channel with TubeBuddy:
www.tubebuddy.com/iosacademy

Пікірлер: 45
@Dragonboh1
@Dragonboh1 4 күн бұрын
keep doing what you doing
@ahmedmasood7694
@ahmedmasood7694 2 жыл бұрын
Thank you, man! fantastic and straightforward explanation. Keep it up man we are grateful 🤝
@kartyysupermarketonline2399
@kartyysupermarketonline2399 3 жыл бұрын
Hey thanks for the video. Quick question: If I launch the simulator with no internet connection, it shows false, and when I turn on the wifi, it still shows false all the time. How can we fix it?
@nathca93
@nathca93 Жыл бұрын
Thank you! This is exactly what I need to solve my problem!
@rungxanh2901
@rungxanh2901 3 жыл бұрын
Thank you Afraz for the tutorial. This literally saves my app from crashing without a connection. I'd suggest running the app on a real device to test out the connectivity, because the NetworkMonitor would update the status almost instantly, unlike with the Simulator 👌🏻
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Thanks for sharing
@user-tq4fv8ie6q
@user-tq4fv8ie6q 3 жыл бұрын
Great video, but I would like you, Afraz, to do a little recap of all code at the end of a video so that we really grasp everything there is thank you
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Thanks for the feedback
@se7enzz258
@se7enzz258 3 жыл бұрын
you are awesome!
@akshaysharma9995
@akshaysharma9995 3 жыл бұрын
Hey Afraz this video is good but please last step is not okay I'm implementing the code and first time is code but after disconnect the internet and again connect every time showing false condition can u please fix this issue
@luyuanqiang
@luyuanqiang 2 жыл бұрын
Thia video is useful.🎄🌷🌸🌻💐🌺🌹💐❤🙏🏽
@neilhathaway6858
@neilhathaway6858 2 жыл бұрын
Another great video, thank you. What about the use case where by you are on a phone with a cellular connection to the internet and a wifi connection to a non internet connection?
@jamesphuket
@jamesphuket 2 жыл бұрын
Perfect, I have been searching all day on how to do this as there are a lot of older examples based on using Reachability out there, so I assume your method replaces how it was done before. Plus it is great you have shown how to perform the check for a connection from various view controllers. You code if you do't mind will be going directly into my app and I will then add code extension to deal with network up/down scenarios. I have joined you club for future great articles.
@rdkutube
@rdkutube Жыл бұрын
Thank you!
@iOSAcademy
@iOSAcademy Жыл бұрын
Youre welcome
@biin8576
@biin8576 3 жыл бұрын
can you please make a video on a complex auto layout with orientation
@cem890
@cem890 3 жыл бұрын
The most clearly explaining video I've watched
@EdRawrDev5813
@EdRawrDev5813 2 жыл бұрын
I was reaching if there is any way to fetch the signal strength , do you have an idea of how to do this?
@wahibhaddaoui5156
@wahibhaddaoui5156 3 жыл бұрын
it's a good vidéo. But i face a problem with your class. When the UI appears and the connection is here, it said so. When I switch off the connexion, it's said so. But but but, after that, when i swich on the connexion, it didn'nt see it and consider that the connexion isn't here. Could you please tell me if you face the same problem when you test this protocol?
@aliakkawi4759
@aliakkawi4759 6 ай бұрын
Thanks for the tutorial, is there a way to get the Wifi dns “search domains”? Thanks
@nazzabazza842
@nazzabazza842 Жыл бұрын
too good
@iOSAcademy
@iOSAcademy Жыл бұрын
Thanks
@jackaustin9944
@jackaustin9944 3 жыл бұрын
It's a good solution assuming that you connection is active, but if your connected to a wifi network that isn't connected to the internet then this will give you false results.
@sreekanthzyou
@sreekanthzyou 3 жыл бұрын
How to know 5G or LTE network type in case of cellular?
@abdulwahabkhan4316
@abdulwahabkhan4316 2 жыл бұрын
Thanks Afraz for tutorial ... I am here because it triggers unsatisfied when the network is connected and vise versa... i don't know may be its happning on simulator and work fine on physical device ... i did't test it yet on physical device.. -_-
@curt8806
@curt8806 3 жыл бұрын
Does this work if wifi is connected but it's not a real active internet connection? Like if internet is down at my house but wifi is active?
@TOURPETOUR
@TOURPETOUR 3 жыл бұрын
Hi, I have uploaded my app and it is been more than 25 days and ad still not showing. I have both android ad unit which is showing ad no issue at all but I created ad unit with iOS application 30 days ago and my app was approved 25 days ago but still ad not showing. Please tell my why?
@dev_jeongdaeri
@dev_jeongdaeri 3 жыл бұрын
You are amazing! 🤩👍👍👍
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Thanks! Make sure to subscribe
@amarasangkuti
@amarasangkuti 2 жыл бұрын
how to save connection type in a variable?
@book6202
@book6202 2 жыл бұрын
Is it possible to check network speed ?
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Yes
@kokalti
@kokalti 3 жыл бұрын
Now I am on wifi how do I get the wifi name and password?
@user-qt5ul9qx4m
@user-qt5ul9qx4m 3 жыл бұрын
his does not guarantee the existence of the connection itself
@tekilla79
@tekilla79 2 жыл бұрын
Dirt code and jumping in xcode like a crazy. That hands much faster then brains…
@mohamadmortada8347
@mohamadmortada8347 3 жыл бұрын
What if I wanted to state the if it's Wifi or cellular how do I do that?
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Check the type on the path in the update handler :)
@mohamadmortada8347
@mohamadmortada8347 3 жыл бұрын
@@iOSAcademy Can you tell me how to do that I didn’t get how you do that?
@wristocrat
@wristocrat Жыл бұрын
You are HIM
@iOSAcademy
@iOSAcademy Жыл бұрын
Thanks
@christostsangaris4785
@christostsangaris4785 2 жыл бұрын
Great video as always! Any idea where we should execute NetworkMonitor.shared.stopMonitoring()? Thanks!
Why Does Your Internet Connection Randomly Stop Working?
6:11
Techquickie
Рет қаралды 5 МЛН
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 91 МЛН
A teacher captured the cutest moment at the nursery #shorts
00:33
Fabiosa Stories
Рет қаралды 55 МЛН
BETTER Phone WiFi in 30 Seconds!
8:42
Linus Tech Tips
Рет қаралды 2,4 МЛН
I-Team: Hidden cameras reveal dark side of solar power
6:21
FOX 5 Atlanta
Рет қаралды 4,5 МЛН
101 Weird But Useful Minecraft Hacks
48:36
Skip the Tutorial
Рет қаралды 4,2 МЛН
Networking Connectivity in iOS Using NWPathMonitor
13:38
azamsharp
Рет қаралды 2,8 М.
How to get Faster Internet speed when you change a simple setting
8:22
The moment we stopped understanding AI [AlexNet]
17:38
Welch Labs
Рет қаралды 853 М.
Swift Tutorial: Save & Get Data with User Defaults
19:42
iOS Academy
Рет қаралды 28 М.