title: if condition in swift function for optional parameter
body: <p>I have a function : myFunction(param1: class?, param2: class?, param3: Int, ...) where the 2 first parameters are optional and the type of them is a custom class.
  But sometimes, the class I need to put in these parameters doesn't exist, that's why these parameters are optional. And I can't put 'nil' as value.</p>
  
  <p>So I would like to do something like this :</p>
  
  <pre><code>if (param1 !=nil &amp;&amp; param2 != nil) {
     myFunction(param1: myClass, param2: myClass, param3: 2, ...)
  }
  else if (param1 ==nil &amp;&amp; param2 == nil) {
     myFunction(param3: 2, ...)
  }
  else if (param1 !=nil &amp;&amp; param2 == nil) {
     myFunction(param1: myClass, param3: 2, ...)
  }
  else if (param1 ==nil &amp;&amp; param2 != nil) {
     myFunction(param2: myClass, param3: Int, ...)
  }
  </code></pre>
  
  <p>...</p>
  
  <p>The problem is that, in my function I have more optional parameters so if I need to have a "if" condition for all options, it will be impossible to manage.</p>
  
  <p>So is there a way to put an if condition inside the function parameters ? Example :</p>
  
  <pre><code>myFunction(myClass==nil ? &lt;nothing&gt;:param1: myClass, myClass==nil ? &lt;nothing&gt;:param2: myClass, param3: 2, ...)
  </code></pre>
  
  <p>Thanks a lot for your help :)</p>
  
  <p>Regards,</p>