title: Call Swift function with parameters from Objective C class
body: <p>I have a library class wrote in swift which should be used in my existing objective-c code.
  I have created the bridging-header and have define @class MySwiftClass in .h and import "-Swift.h" in .m</p>
  
  <p>a swift class is something similar to this</p>
  
  <pre><code>@objc class MySwiftClass: NSObject {
      var firstName : String
      var lastName: String
  
      public init(firstName: String, lastName: String) throws {
          guard !firstName.isEmpty &amp;&amp; !lastName.isEmpty else { throw SOME_ERROR }
          self.firstName = firstName
          self.lastName = lastName
          super.init()
      }
  
  
  func methodWithParams(city: String, suburb: String) throws -&gt; String {
          return city + suburb
      }
  </code></pre>
  
  <p>I have faced two problems.</p>
  
  <ol>
  <li><p>Don't know how to call swift <code>init</code> function on the objective-c class. I have tried <code>MySwiftClass *myClass = [MySwiftClass init];</code>. Up to this, the app can compile. But don't know how to pass the parameters.</p></li>
  <li><p>I also want to access <code>myClass.methodWithParams(city:"My city", suburb:"My country")</code> in objective-c class.</p></li>
  </ol>
  
  <p>Appreciate the help!</p>