-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c64df7
commit b553b7c
Showing
1 changed file
with
7 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
# Swift-Lazy-Patterns | ||
A few lazy patterns for Swift 4 | ||
# Swift Lazy Patterns | ||
A few lazy patterns for Swift 4. Note that, if you are OK with the behavior of Swift's `lazy` keyword, you should use that. This is for [those who want very specific behaviors](https://stackoverflow.com/a/40847994/3939277): | ||
|
||
* [`Lazy`](https://github.com/BenLeggiero/Swift-Lazy-Patterns/blob/master/Lazy.swift#L28-L78): A non-resettable lazy pattern, to guarantee lazy behavior across Swift language versions | ||
* [`ResettableLazy`](https://github.com/BenLeggiero/Swift-Lazy-Patterns/blob/master/Lazy.swift#L82-L167): A resettable lazy pattern, whose value is generated and cached only when first needed, and can be destroyed when no longer needed. | ||
* [`FunctionalLazy`](https://github.com/BenLeggiero/Swift-Lazy-Patterns/blob/master/Lazy.swift#L171-L221): An idea about how to approach the lazy pattern by using functions instead of branches. | ||
|