Displaying Alerts with UIAlertController in Swift

Aasif
By Aasif | Last Updated on December 3rd, 2021 10:34 am | 5-min read

In this tutorial, you’ll learn how to use the UIAlertController class to display alert dialogs in your iOS app. We’ll dive into setting up the alerts, responding to user actions, and getting input from the user with text fields. The UIAlertController is a basic but important part of the iOS SDK, and it’s the default way to ask users to confirm an action. On top of that, UIAlertController also supports the action sheet, which is a convenient dialog style that allows your app’s users to [...]

Read More

Networking in Swift with URLSession

Aasif
By Aasif | Last Updated on December 3rd, 2021 10:34 am | 5-min read

In this tutorial, we’ll discuss how you can use the URLSession suite of components, classes and functions to make HTTP GET and POST network requests. You’ll learn how to validate response data, and how to add additional parameters like headers to requests. Almost every app will communicate with the internet at some point. How does that work? What Swift code can you use to make HTTP(S) networking requests? Fetching and downloading data from and to webservices is a skill any pragmatic iO [...]

Read More

How To: Pass Data Between View Controllers in Swift

Aasif
By Aasif | Last Updated on December 3rd, 2021 10:33 am | 8-min read

If your app has multiple User Interfaces (UIs), you’ll want to move data from one UI to the next. How do you pass data between view controllers in Swift? Passing data between view controllers is an important part of iOS development. You can use several ways to do so, and all of them have distinct advantages and drawbacks. The ability to pass data between view controllers with ease is affected by your choice of app architecture. App architecture affects how you work with view controllers, [...]

Read More

For Loops in Swift (How To)

Aasif
By Aasif | Last Updated on December 3rd, 2021 10:30 am | 5-min read

A for loop is a fundamental concept of programming. You can repeat code with a for loop, and make your code more expressive and elegant. You use for-in, while and repeat-while to loop in Swift. In this tutorial you’ll learn how to use the for-in loop, with collections and ranges, and how to use other approaches like while and repeat-while. The for loop in Swift is a super useful tool in any developer’s toolkit, so it’s a must to master as a practical iOS developer. Table of Conten [...]

Read More

Working with Codable and JSON in Swift

Aasif
By Aasif | Last Updated on January 10th, 2022 8:02 am | 6-min read

You can use Codable in Swift to encode and decode custom data formats, such as JSON, to native Swift objects. It’s incredibly easy to map Swift objects to JSON data, and vice versa, by simply adopting the Codable protocol. As a pragmatic iOS developer, you’ll come across JSON sooner rather than later. Every webservice, from Facebook to Foursquare, uses the JSON format to get data into and out of your app. How can you encode and decode that JSON data to Swift objects effectively? In thi [...]

Read More

Most Popular Posts