UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Networking

Found 5 articles in the Swift Knowledge Base for this category.

 

How to check for internet connectivity using NWPathMonitor

Apple’s Network framework provides a number of useful classes for working with network data, including one specifically designed to monitor network accessibility: NWPathMonitor. If you ever used Apple’s older Reachability system, NWPathMonitor replaces it fully.... Continue Reading >>

How to create a peer-to-peer network using the multipeer connectivity framework

The MultipeerConnectivity framework is designed to allow ad hoc data transfer between devices that are in close proximity. The connection is started managed for you by iOS, but you're responsible for presenting useful interface to your users and for understanding the data that is being sent and received.... Continue Reading >>

How to download files with URLSession and downloadTask()

URLSession is designed to make network transfers as easy as possible, and a great example of that is its downloadTask()` method. This fetches the contents of a URL you specify, saves it to a local file, then calls a completion handler so you can manipulate the file – all in one.... Continue Reading >>

How to make a network request wait for an internet connection using waitsForConnectivity

If you use URLSession to make a data task while the user has no internet connection, your request will fail immediately and report an error. However, if you create your session with the waitsForConnectivity configuration option set to true, then the system will automatically wait some time to see if connectivity becomes available before trying the request.... Continue Reading >>

How to support low data mode networking using allowsConstrainedNetworkAccess

iOS lets users enable Low Data Mode for any cellular or WiFi connection, which signals to apps that they should be careful how much data they use. This might mean downloading lower-resolution images, it might mean disabling prefetching, or some other way of cutting down on bandwidth use.... Continue Reading >>

About the Swift Knowledge Base

This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions, all written for Swift 5.4.

BUY OUR BOOKS
Buy Pro Swift Buy Pro SwiftUI Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let us know!

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.