<div dir="ltr"><div>Here is how I would like this to be implemented.<br></div><div><br></div><div>1. Optional method requirements will be represented in Swift as methods having import-only attribute @optional and defaulted to be fatalError()</div><div><br></div><div>2. On the inside, this default implementation will not define a method. These objects will not respond to corresponding selector unless the default implementation is overridden.</div><div><br></div><div>3. Calls from Swift side will turn into checks with fatalError()</div><div><br></div><div>4. The only way to check existence of such method from Swift will be `responds(to: Selector)`</div><div><br></div><div>Example:</div><div><br></div><div>// Objective-C protocol is imported as:</div><div>protocol <span style="color:rgb(0,0,0);white-space:pre-wrap">NSTableViewDelegate {</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">    @optional </span><span style="color:rgb(0,0,0);white-space:pre-wrap">func tableView(_: NSTableView, viewFor: NSTableColumn, row: Int) -&gt; NSView?</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">    @optional </span><font color="#000000"><span style="white-space:pre-wrap">func tableView(_: NSTableView, heightOfRow: Int) -&gt; CGFloat</span></font></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">}</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">extension NSTableViewDelegate {</span></div><span style="color:rgb(0,0,0);white-space:pre-wrap">    @optional </span><span style="color:rgb(0,0,0);white-space:pre-wrap">func tableView(_: NSTableView, viewFor: NSTableColumn, row: Int) -&gt; NSView? {</span><div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">        fatalError(&quot;Unimplemented&quot;)</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">    }</span></div><span style="color:rgb(0,0,0);white-space:pre-wrap">    @optional </span><font color="#000000"><span style="white-space:pre-wrap">func tableView(_: NSTableView, heightOfRow: Int) -&gt; CGFloat {</span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">        </span></font><span style="color:rgb(0,0,0);white-space:pre-wrap">fatalError(&quot;Unimplemented&quot;)</span><div><span style="color:rgb(0,0,0);white-space:pre-wrap">    }</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">}</span></div><div><br></div><div>class MyDelegate : <span style="color:rgb(0,0,0);white-space:pre-wrap">NSTableViewDelegate {</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">    </span><span style="color:rgb(0,0,0);white-space:pre-wrap">@optional </span><span style="color:rgb(0,0,0);white-space:pre-wrap">func tableView(_: NSTableView, viewFor: NSTableColumn, row: Int) -&gt; NSView? {</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">        //...</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">    }</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">}</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap"><br></span></div><div><font color="#000000"><span style="white-space:pre-wrap">getTableViewDelegate().tableView(x, heightOfRow: y)  // will fatalError() if not responds to selector</span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">if </span></font><span style="color:rgb(0,0,0);white-space:pre-wrap">getTableViewDelegate().responds(to: #selector(...)) { ... }</span></div><div><br></div>- Anton</div></div>