Cannot find type 'myInstance' in scope

this works but if I take away the comment before print I get 
Cannot find type 'myInstance' in scope
that obvisly work in the Text statment
Why?

//
// ContentView.swift
// myTest
//
// Created by N.N on 2020-11-25.
//

import SwiftUI

struct ContentView: View {
  var myInstance = MyClass()
//  print(myInstance.theName)

  var body: some View {

    Text(myInstance.theName)
      .padding()
  }
}

struct ContentView_Previews: PreviewProvider {
  static var previews: some View {
    ContentView()
  }
}
class MyClass {
  var theName: String = "myName"
}
Code Block
import SwiftUI
struct ContentView: View {
var myInstance = MyClass()
// print(myInstance.theName)
var body: some View {
Text(myInstance.theName)
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
class MyClass {
var theName: String = "myName"
}

You cannot put a statement, should it be a print, in the declaration part.
The error I get is
Expected 'func' keyword in instance method declaration

Even a line 5 as
Code Block
print("Nothing")

would fail
Cannot find type 'myInstance' in scope
 
 
Q