Gio Lodi 12/23/2020

How to set default values in Swift compiler-generated initializers

Read Original

This technical Swift programming article details a method for setting default values for properties in a struct without losing the compiler-generated initializer. It contrasts a custom initializer with using a private(set) var to maintain immutability for consumers while allowing internal mutation, offering a time-saving development trick.

How to set default values in Swift compiler-generated initializers

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week