Validating email addresses using RawRepresentable and NSDataDetector
How to validate email addresses in Swift using a dedicated RawRepresentable type and Foundation’s NSDataDetector API.
Articles, podcasts and news about Swift development, by John Sundell.
How to validate email addresses in Swift using a dedicated RawRepresentable type and Foundation’s NSDataDetector API.
This week, let’s take a look at a few different ways that reducers can be used in Swift — ranging from transforming sequences, to accumulating asynchronous values using Apple’s new Combine framework, and beyond.
One way of transforming values in Swift is by mapping a collection into an array of new values, using a transform. The Swift standard library offers three main APIs for that kind of mapping — map, flatMap and compactMap. Let’s take a look at how they work.
Almost every Swift program uses collections in one way or another. Whether it's to store values to be displayed in some form of list, to keep track of observers, or caching data - collections are everywhere. This week, let's take a look at some of the standard library APIs that let us easily transform collections in a very functional way.