Swift Result Builders: The Basics You Need to Know! Officially available in Swift 5.4, Result Builders is a Swift feature that enables functions to build up a result value from a sequence of components. In this post, Lee Kah Seng teaches us how this feature works, and how we can build custom Result Builders. Posted on April 13, 2021 #results builders
Custom Property Wrappers for SwiftUI A Swift property wrapper adds a layer of separation between code that defines a property and code that managers how a property is stored. By creating custom property wrappers, we write the management code once when we define the wrapper, and then reuse this code when we apply the wrapper to properties. In this post, Dave Delong shares some useful property wrappers that he has come up with while working on SwiftUI. Posted on April 12, 2021 #swiftui #property wrapper
Why Swift closures are not Equatable Closures in Swift are reference types, and as such, we might assume that they are Equatable. However, that is not the case, and in this post, Jesse Squires digs into some old forum posts to help explain why. Posted on April 9, 2021 #compiler #closure #equatable
The Context And The Logic This is a great post by Soroush Khanlou in which he writes about the two main types of tasks professional programmers work on. Soroush frames these two types of tasks as the context and the logic, arguing that most of a professional programmer's time is spent on the context. This framing allows Soroush to illustrate two important points - that his job is not primarily about programming logic, and that by minimizing the context, he can spend more time on the good stuff. Posted on April 7, 2021 #logic
SwiftOnTap - Complete SwiftUI Docs with Examples This is a cool resource created by members of the Swift community. Its aim, as they put it, is to fill Apple's documentation hole by providing complete SwiftUI documentation with examples. One to bookmark. Posted on April 6, 2021 #swiftui
Why Swift Reference Types Are Bad for App Startup Time When an app is launched, the operating system performs several tasks to get the app ready for use. One of these tasks is rebasing pointers in binary metadata that describe types in the app code. In this very interesting post, Noah Martin explains how Swift reference types can result in a large number of pointers that require rebasing, leading to slow app startup times. Posted on April 2, 2021 #objective-c #reference types
Be careful with Obj-C bridging in Swift Type casting in Swift allows us to treat an instance as a different instance of a superclass or subclass from its hierarchy. It's accomplished using the as operator. However, did you know that the as operator is also the Objective-C bridging operator? In this post, Bruno Rocha explains why we need to pay extra attention when casting to make sure we are not also bridging from Swift to Objective-C types. Posted on March 26, 2021 #objective-c #type-casting
How to use @autoclosure in Swift to improve performance An autoclosure is a Swift closure that is automatically created to wrap an expression passed as a function argument. In this post, Antoine Van Der Lee demonstrates how we can use autoclosures and provides examples of Swift APIs which use this feature. Posted on March 17, 2021 #autoclosure
Exploiting String Interpolation For Fun And For Profit String interpolation allows us to construct a Swift String value from a mix of constants, variables, literals, and expressions. In this post, Dave Delong gets creative with interpolation, creating what he describes as a solution in search of a problem. Posted on March 12, 2021 #string
Core Store Core Data is an object graph and persistence framework provided by Apple. Introduced in iOS 3.0, it's still relevant but is also generally acknowledged as not being particularly Swift friendly. In this post, the excellent Daniel Steinberg makes an early prediction for a Swift replacement of Core Data which he thinks might be unveiled at this year's WWDC. Posted on March 8, 2021 #wwdc21 #core data