Created
October 9, 2024 13:00
-
-
Save lucianoschillagi/ed43c20b0b871cdf7a1ec2fd08ff6ad5 to your computer and use it in GitHub Desktop.
converting an function into a computed property
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
import Foundation | |
struct Cat { | |
// func saySomething() -> String { | |
// return "Muuu! I mean 'Miau!'" | |
// } | |
// Now, I am going to convert this method into a computed property | |
var saySomething: String { | |
return "Muuu! I mean 'Miau!'" | |
} | |
} | |
let mishi = Cat() | |
mishi.saySomething |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment