Creating a new Swift Playground in the Playgrounds App on iPad or macOS, I get an empty Playground, and a UserModule with a SharedCode.swift file in it. In SharedCode.swift there’s just a comment that says:
// Code inside modules can be shared between pages and other source files.
I added a simple function to it:
func hello() {
print ("hello")
}
Then I tried calling hello() from the main playground. I get the error “Cannot find ‘hello’ in scope.”
I can see, from auto-completion, that UserModule is a known entity in the main playground’s scope. But I don’t know how to set things up so that I can access my hello function, and I can’t find anything helpful in the docs. Could someone point me in the right direction, please?