Shopify Mobile Hybrid Architecture
A Kotlin Style .copy Function for Swift Structs - Shopify

A Kotlin Style .copy Function for Swift Structs - Shopify

9/2/2021

What this post added

This post introduces a solution for implementing a Kotlin-like `.copy()` function in Swift structs to facilitate immutable object patterns. It details the challenges with Swift's default initializers and optional properties, proposes a builder pattern as an alternative, and highlights the use of Sourcery for automating the generation of initializers and builders, thereby reducing boilerplate code for developers working with immutable state in the iOS codebase.

Read the original post ↗