Functions: are self-contained chunks of code that perform a specific task. You give a function a name that identifies what it does, and this name is used to “call” the function to perform its task when needed.
Method: The things that provide functionalities to an object is commonly called a method. A method is simply a function that belongs to an object.
The syntax to call a method is to take the object, then put a period, then put by the name of the method. Afterwards, you put parenthesis, and then any parameters to the method, which you can think of as input to the method. The methods you’ve used so far, like fontWeight or foreground color, have been written for you by the engineers at Apple.
0 comments on “5. Objects, Data, and Methods _Your First iOS and SwiftUI App”