Skip to content

Instantly share code, notes, and snippets.

Created Dec 31, 2020
What would you like to do?
class MyClass {
lazy var names: NSArray = {
let names = NSArray()
print("Only run at the first time access")
return names
let myClass = MyClass()
myClass.names // Only run at the first time access
myClass.names // NO OUTPUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment