title: SwiftUI Calling functions from other class
body: <p>I am having a little trouble here: I have a class </p>
  
  <pre><code>class TempC {
      func GetData(){
            //do stuff
      }
  }
  
  </code></pre>
  
  <p>And in ContentView I want to call the function, but I can't manage to do it, I am getting errors...</p>
  
  <pre><code>struct ContentView: View {
  
  var variable : TempC
  variable.GetData()
  var body: some View {
          Text("Hello World")
      }
  }
  </code></pre>
  
  <p>Or in any other method. How can I call an external function now?</p>
  
  <p>PS: The error that I get are on the line with <code>variable.GetData()</code> which are: </p>
  
  <blockquote>
    <ol>
    <li>Consecutive declarations on a line must be separated by ";"</li>
    <li>Expected "("in argument list of cantons declaration</li>
    <li>Expected "{"in body of function declaration</li>
    <li>Expected 'func' keyword in instance method declaration</li>
    <li>Invalid redeclaration of 'variable()'</li>
    </ol>
  </blockquote>
  
  <p>It's like it is expecting to create a new function not to get the one that is already existing.</p>