In all the other programming languages I’ve used: JAVA, PHP, C, C++, JS, if I want to reference functions they have to be in scope, that is, I have to import the libraries or files that define and prototype classes and functions to be able to call them.
However, in the RandomPassword app, we went ahead and just created the ‘model’ file ‘GeneratePassword.swift’. (page 98). We create some functions (page 99-102) and then in the sub-chapter ‘Connecting the Model Layer to the Controller’ (page 103) we simply write a function call in the existing view controller action ‘generatePassword’ to call these functions from the ‘model layer’, without making any connections or referencing the file.
However, we had to explicitly make connections between the controller and the views for actions / outlets.
How does the view controller know that the function generateRandomString even exists?
Looking for your insights.