Imagine you want to add a method that has no input, in other words, no parameters, but it does have an output, in other words, a return value. To do this, you’d simply add a block of code that looks like this before the final curly brace of your class.
When you enter an open and closed parenthesis, it means it has no input, or no parameters. Then you put a dash and a greater than sign, which looks kinda like an arrow to me. Then you indicate the type of object that you will return as the output of your method, like Int, Double, or Bool. Inside the curly braces, you put all of your code.
0 comments on “23. Writing Methods_Your First iOS and SwiftUI App”