Skip to content

Commit

Permalink
#9 Examples no longer exemplify usage of deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
KyNorthstar committed Aug 31, 2019
1 parent 32277fd commit fc2cff7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ var myLazyString = Lazy<String>() {
return "Hello, lazy!"
}

print(myLazyString.value) // Initializes, caches, and returns the value "Hello, lazy!"
print(myLazyString.value) // Just returns the value "Hello, lazy!"
print(myLazyString.wrappedValue) // Initializes, caches, and returns the value "Hello, lazy!"
print(myLazyString.wrappedValue) // Just returns the value "Hello, lazy!"

myLazyString.value = "Overwritten"
print(myLazyString.value) // Just returns the value "Overwritten"
print(myLazyString.value) // Just returns the value "Overwritten"
myLazyString.wrappedValue = "Overwritten"
print(myLazyString.wrappedValue) // Just returns the value "Overwritten"
print(myLazyString.wrappedValue) // Just returns the value "Overwritten"
```

These will both print:
Expand Down Expand Up @@ -116,7 +116,7 @@ print(myLazyString) // Just returns the value "Hello, lazy!"
myLazyString = "Overwritten"
print(myLazyString) // Just returns the value "Overwritten"
_myLazyString.clear()
print(myLazyString.value) // Initializes, caches, and returns the value "Hello, lazy!"
print(myLazyString.wrappedValue) // Initializes, caches, and returns the value "Hello, lazy!"
```

This will print:
Expand Down Expand Up @@ -154,7 +154,7 @@ print(myLazyString) // Just returns the value "Hello, lazy!"
myLazyString = "Overwritten"
print(myLazyString) // Just returns the value "Overwritten"
_myLazyString.clear()
print(myLazyString.value) // Initializes, caches, and returns the value "Hello, lazy!"
print(myLazyString.wrappedValue) // Initializes, caches, and returns the value "Hello, lazy!"
```

You can also use it directly (instaed of as a property wrapper):
Expand All @@ -165,17 +165,17 @@ var myLazyString = ResettableLazy<String>() {
return "Hello, lazy!"
}

print(myLazyString.value) // Initializes, caches, and returns the value "Hello, lazy!"
print(myLazyString.value) // Just returns the value "Hello, lazy!"
print(myLazyString.wrappedValue) // Initializes, caches, and returns the value "Hello, lazy!"
print(myLazyString.wrappedValue) // Just returns the value "Hello, lazy!"

myLazyString.clear()
print(myLazyString.value) // Initializes, caches, and returns the value "Hello, lazy!"
print(myLazyString.value) // Just returns the value "Hello, lazy!"
print(myLazyString.wrappedValue) // Initializes, caches, and returns the value "Hello, lazy!"
print(myLazyString.wrappedValue) // Just returns the value "Hello, lazy!"

myLazyString.value = "Overwritten"
print(myLazyString.value) // Just returns the value "Overwritten"
myLazyString.wrappedValue = "Overwritten"
print(myLazyString.wrappedValue) // Just returns the value "Overwritten"
_myLazyString.clear()
print(myLazyString.value) // Initializes, caches, and returns the value "Hello, lazy!"
print(myLazyString.wrappedValue) // Initializes, caches, and returns the value "Hello, lazy!"
```

These will both print:
Expand Down

0 comments on commit fc2cff7

Please sign in to comment.