<I realize similar questions have already been asked, but they have very complex questions or insufficient answers (I'm a beginner with swift)>
I've included a very basic example that summarizes my issue
struct Greeting {
var name = "Bob"
var message = "Hi, " + name
}
var a = Test("John")
print(a.message)
I get the following error:
error: cannot use instance member 'name' within property initializer; property initializers run before 'self' is available
I've tried initializing the values, creating my best guess at lazy vars, and making the vars computed values. Any help would be appreciated!
print(a.message)needs to go inside a function. Unless you're using Swift Playgrounds.var a = Test("John"); print(a.message)inside anonAppear.