Donny Wals
  • Home
  • The Blog
  • The Newsletter
  • Speaking
  • Books
    • Practical Core Data
    • Practical Combine

Combine

Observing the result of saving a background managed object context with Combine

I love posts where I get to put write about two of my favorite frameworks at the moment; Combine and Core Data. When you’re working with Core Data, it’s common to perform save operations asynchronously using a background context. You could even perform an asynchronous save on the main managed Read more…

By donnywals, 1 month1 month ago

Building a concurrency-proof token refresh flow in Combine

Refreshing access tokens is a common task for many apps that use OAuth or other authentication mechanisms. No matter what your authentication mechanism is, your tokens will expire (eventually) and you’ll need to refresh them using a refresh token. Frameworks like RxSwift and Combine provide convenient ways to build pipelines Read more…

By donnywals, 2 months2 months ago

Building a simple remote configuration loader for your apps

Remote configuration is a common practice in almost every app I have worked on. Sometimes these configurations can be large and the implications of a configuration change can be far-reaching while other times a configuration is used to change the number of items shown in a list, or to enable Read more…

By donnywals, 3 months3 months ago

Observing changes to managed objects across contexts with Combine

A common pattern in Core Data is to fetch objects and show them in your UI using one managed object context, and then use another context to update, insert or delete managed objects. There are several ways for you to update your UI in response to these changes, for example Read more…

By donnywals, 3 months3 months ago

Configuring error types when using flatMap in Combine

When you’re using Combine for an app that has iOS 13 as its minimum deployment target, you have likely run into problems when you tried to apply a flatMap to certain publishers in Xcode 12. To be specific, you have probably seen the following error message: flatMap(maxPublishers:_:) is only available Read more…

By donnywals, 4 months4 months ago

Implementing a one-way sync strategy with Core Data, URLSession and Combine

A common use of a Core Data store is to cache data from a remote resource locally to support offline functionality of an app. There are multiple ways to implement a caching mechanism and many of them don’t involve Core Data. For example, you could simply fetch a JSON file Read more…

By donnywals, 5 months ago

Implementing an infinite scrolling list with SwiftUI and Combine

Tons of apps that we build feature lists. Sometimes we build lists of settings, lists of todo items, lists of our favorite pictures, lists of tweets, and many other things. Some of these lists could scroll almost endlessly. Think of a Twitter timeline, a Facebook feed or a list of Read more…

By donnywals, 7 months7 months ago

Using custom publishers to drive SwiftUI views

In SwiftUI, views can be driven by an @Published property that’s part of an ObservableObject. If you’ve used SwiftUI and @Published before, following code should look somewhat familiar to you: class DataSource: ObservableObject { @Published var names = [String]() } struct NamesList: View { @ObservedObject var dataSource: DataSource var body: Read more…

By donnywals, 7 months4 months ago

Ignore first number of elements from a publisher in Combine

If you have a Combine publisher and you want to ignore the first n elements that are published by that publisher, you can use the dropFirst(_:) operator. This operator will swallow any values emitted until the threshold you specify is reached. For example, dropFirst(1) will ignore the first emitted value Read more…

By donnywals, 7 months ago

Recursively execute a paginated network call with Combine

Last week, my attention was caught by a question that Dennis Parussini asked on Twitter. Dennis wanted to recursively make calls to a paginated API to load all pages of data before rendering UI. Since I love Combine and interesting problems I immediately started thinking about ways to achieve this Read more…

By donnywals, 7 months7 months ago

Posts navigation

1 2 3 Next
Categories
  • Books
  • Home
  • The Blog
  • The Newsletter
  • Speaking
Hestia | Developed by ThemeIsle