 <p>What you are referring in Java is called <a href="http://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html" rel="nofollow">anonymous inner class</a> - you are actually declaring a one-time derived class inline.</p> <p><strong>Unfortunately</strong> Swift doesn't have this feature.</p> <p><strong>But</strong> you can consider passing a closure to the instance.</p> <p>Lets say that your Card class have a var <code>getCardFunction</code>:</p> <pre><code>Class Card { var getCardFunction : () -&gt; Int } </code></pre> <p>Now you can pass the function you desire after initialising:</p> <pre><code>var card = Card() card.getCardFunction = { return 6 } </code></pre> <p><strong><em>Note</em></strong>: you can even have a default value for the <code>getCardFunction</code> function:</p> <pre><code>Class Card { var getCardFunction : () -&gt; Int = { return 3 } } </code></pre>