Authenticating the User
Oct 13, 2021, 2:30 AM
With the view and the view model in place, we can authenticate the user. In this episode, you learn how to authenticate a user using the URLSession API and basic authentication.
Adopting the Model-View-ViewModel Pattern
Oct 12, 2021, 2:30 AM
In the previous episode, we built a sign in form using SwiftUI. In this episode, we create and integrate a view model that drives the sign in form.
Building the User Interface
Oct 11, 2021, 2:30 AM
In this series, we build a sign in form using SwiftUI. In the first episode, we build the user interface. In the next episodes, we apply the model-view-viewmodel pattern and perform a network request to sign the user in. At the end of this...
Working with Units and Measurements in SwiftUI
Oct 6, 2021, 2:30 AM
A few years ago, Apple added a number of APIs to the Foundation framework to make it easier to work with units and measurements. The APIs are flexible and straightforward to use. As of this year, SwiftUI integrates with these APIs to make...
Customizing Views with Modifiers
Jul 28, 2021, 12:30 AM
To customize a view in a UIKit or AppKit application, you update one or more of the view's properties. For example, to change the text color of a UILabel instance, you update the label's textColor property. That is an imperative approach...
Working with Xcode Previews
Jul 21, 2021, 12:30 AM
SwiftUI's declarative syntax makes it straightforward to describe the user interface you have in mind. The API is intuitive and the framework's learning curve is gentle. But Apple didn't stop there. SwiftUI is deeply integrated into Xcode,...
What Is a View
Jul 14, 2021, 12:30 AM
A view is the fundamental building block of your application's user interface. You already know that a view is a type that conforms to the View protocol. In this episode, we take a closer look at views and the View protocol.
Exploring a SwiftUI Application
Jul 7, 2021, 12:30 AM
While it is possible to integrate SwiftUI into a UIKit or AppKit application, this series focuses on building applications that are built entirely using SwiftUI.
What Is SwiftUI
Jun 30, 2021, 12:30 AM
SwiftUI is Apple's brand new framework for building user interfaces for iOS, tvOS, macOS, and watchOS. Apple introduced SwiftUI in 2019 and the framework has been evolving at a rapid pace ever since. Unlike UIKit and AppKit, SwiftUI is a...
Transforming Publishers with Flat Map
Jun 23, 2021, 12:30 AM
The API the image service exposes no longer accepts a completion handler. It returns a publisher instead. This is an improvement, but the image service still uses completion handlers under the hood. In this episode, we replace the...
Replacing Completion Handlers with Futures
Jun 16, 2021, 12:30 AM
In the previous episode, you learned about futures and promises. In this episode, I show you how to use them in a project.
Futures and Promises
Jun 9, 2021, 12:30 AM
Earlier in this series, you learned how a subject can bridge the gap between imperative programming and reactive programming. While subjects are convenient in many ways, they are not always the best option. The Combine framework provides...
Five Signs of Code Smell in Swift
Jun 2, 2021, 12:30 AM
The first application I published on the App Store was littered with code smells, bad practices, and anti-patterns. The application worked, but it was a challenge to maintain. Adding features to a large, complex project becomes...
Avoiding Infinite Loops
May 26, 2021, 12:30 AM
Infinite loops are every developer's nightmare, especially if they have disastrous consequences. You need to be mindful of infinite loops when working with Combine or any other reactive framework. The difficulty is that it isn't always...
Seven Xcode Tricks Every Developer Should Know
May 19, 2021, 12:30 AM
To be productive and efficient, you need to know your tools. For a Swift developer, that means mastering Xcode. While Xcode is a complex piece of software with a fairly steep learning curve, the tricks I show you in this episode should...
Image Caching with Kingfisher
May 12, 2021, 12:30 AM
In the previous episodes, we implemented a service to fetch and cache remote images. Even though the service we built is pretty flexible, some applications require a more powerful solution and more options to fit their needs. This episode...
Limiting the Cache on Disk
May 5, 2021, 12:30 AM
Earlier in this series, you learned that a cache on disk has a number of benefits. It persists the cache across launches and it can be used to seed a cache in memory. Even though modern devices have plenty of disk space, we need to be...
Asynchronously Reading Data from Disk
Apr 28, 2021, 12:30 AM
The previous episodes have illustrated that caching images can result in significant performance improvements. In the previous episode, I stressed the importance of writing cached images to disk on a background thread to prevent the image...
Caching Images on Disk
Apr 21, 2021, 12:30 AM
In this episode, we continue to improve the solution we implemented in this series by caching images on disk. Caching images on disk has a number of benefits. It reduces the number of requests the application makes and it improves the...
Caching Images in Memory
Apr 14, 2021, 12:30 AM
We added the ability to cancel image requests in the previous episode. This and the next episode focus on caching images. We start simple by caching images in memory.
Cancelling Image Requests
Apr 7, 2021, 12:30 AM
Most applications display images in some way, shape, or form. Those images are often fetched from a remote server, introducing a number of interesting challenges. Performing a request to a remote server takes time and it requires...
Failable Initializers
Mar 31, 2021, 12:30 AM
If you are new to Swift, then you may be wondering what a failable initializer is and why you would ever use one. In this episode, I show you how to create a failable initializer and I hope I can convince you of their benefits. I use...
Recovering from Errors
Mar 24, 2021, 1:30 AM
Cloudy shows the user an error if it isn't able to fetch weather data from the weather API. We map any errors that are thrown to WeatherDataError in the RootViewModel class. This solution works fine and it is a fitting implementation for...
Handling Errors
Mar 17, 2021, 1:30 AM
Even though we successfully used the Combine framework to fetch data from the weather API, the implementation is incomplete. We ignored error handling up until now and it is time to take a closer look at errors and how to handle them.
Networking and Schedulers
Mar 10, 2021, 12:30 AM
Earlier in this series, you learned that reactive programming can be defined as working with asynchronous streams of data. A network request is an asynchronous operation and that makes reactive programming an excellent match for networking.
Adding Type Safety to User Defaults with Extensions
Mar 3, 2021, 12:30 AM
The interface of the UserDefaults class is easy to use, but it lacks type safety. If you want to store and retrieve an enum, for example, you need to jump through a few hoops. Let me show you an example from Cloudy, the application we...
Builders
Feb 24, 2021, 12:30 AM
The builder pattern isn't a common pattern in Swift and Cocoa development and you don't find it in any of Apple's frameworks. It is one of the Gang of Four design patterns and widely used in Java development.
Subscribing to Settings Changes
Feb 17, 2021, 12:30 AM
In this episode, we fix the settings view using the Combine framework. We no longer rely on the delegation pattern to propagate settings changes. In the previous episode, we created a view model for the settings view controller. The...
Driving Table View Cells with Combine
Feb 10, 2021, 12:30 AM
Earlier in this series, we broke the settings view. The root view controller acts as the delegate of the settings view controller, but nothing happens when the user updates a setting in the settings view. In this and the next episode, we...
Initializer Injection with View Controllers, Storyboards, and Segues
Feb 3, 2021, 12:30 AM
In the previous episode, you learned that it is possible to use initializer injection in combination with storyboards as of iOS 13 and tvOS 13. We didn't cover segues in that episode, though. That is the focus of this episode. Let's take a...
Initializer Injection with View Controllers and Storyboards
Jan 27, 2021, 12:30 AM
Storyboards have many benefits, but they also have a number of significant downsides. Not being able to control the initialization of a view controller is one of them, especially if you want to use initializer injection. As of iOS 13 and...
Abstract Classes
Jan 20, 2021, 12:30 AM
The title of this episode is a bit misleading because the Swift programming language has no support for abstract classes. There are a few workarounds, though. In this episode, we take a look at two alternatives to the abstract class...