Fresh Swift
  • About
  • Tags
Fresh Swift

#lazy


Statically computed default property values

As John Sundell writes in the introduction to this short post, defining default values for our API properties can improve the usability of our APIs while still enabling customization when needed. With that in mind, John shares a tip for setting a default property value while also reminding us of a crucial difference between a lazy property and a non-lazy one.

Posted on December 7, 2020

#property  #lazy 

Swift Lazy Property Initialization

We are all most likely familiar with lazy stored properties in Swift, but this post from Use Your Loaf provides a convenient overview of what they are, and how and when we should use them.

Posted on May 28, 2018

#lazy  #initialization 

Using Lazy to Delay Computation

Short post reminding us that Swift’s lazy modifier can be used for more than just property declarations.

Posted on February 10, 2018

#lazy  #functional 

Lazy Collections in Swift

Goksel Koksal with a lightning read in which he demonstrates how we can take advantage of Swift lazy collections. Goksel shows us how to reduce the number of computations in a chain of calls using the lazy variation of Array.

Posted on November 26, 2017

#lazy  #collection 

Injecting forEach into chained method calls

Ole Begemann creates his own version of Swift’s forEach method. The purpose is to create a version of the method which can be used in a sequence of chained method calls, and Ole extends the implementation to make his version compatible with lazy sequences.

Posted on November 10, 2017

#lazy  #sequence 

Using lazy properties in Swift

Lazy properties are great when we want to delay expensive creation of type properties. Here, John Sundell describes the various approaches we can take when using lazy properties, from the basics of simply using the lazy keyword, to using factory methods to extract initialization code and reduce complexity.

Posted on May 19, 2017

#lazy 

 •  2021  •  Fresh Swift

Hugo v0.80.0 powered  •  Theme by Beautiful Jekyll adapted to Beautiful Hugo