<div dir="ltr">On 3 November 2017 at 16:42, Adam Kemp <span dir="ltr"><<a href="mailto:adam_kemp@apple.com" target="_blank">adam_kemp@apple.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div class="gmail-h5"><div><br></div></div></div><div>If that’s the case then this wouldn’t solve one of the major use cases I listed for this: splitting up cross-platform classes into platform-specific files. The idea is that each target contains a different subset of the files. Consider a case where two platforms are similar enough to share some code but not all code. For instance:</div><div><br></div></div></blockquote><div> </div><div>i think we need a better real-world example, as in this one it's probably easier to have "View" defined as a type alias to either UIView or NSView depending upon a platform and similarly define currentGraphicsContext() to be either UIGraphicsGetCurrentContext() or NSGraphicsContext.currentContext()?.CGContext depending upon a platform and have a single code base afterwords:</div><div><br></div><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="color:rgb(4,51,255)">class</span> PresentationView: <span style="color:rgb(52,149,175)">View</span> {</p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"> <span style="color:rgb(4,51,255)">private</span> <span style="color:rgb(4,51,255)">func</span> draw(inContext context: <span style="color:rgb(52,149,175)">CGContext</span>) {</p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,143,0)"><span style="color:rgb(0,0,0)"> </span>// Shared CoreGraphics drawing</p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"> }</p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);min-height:13px"> </p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"> <span style="color:rgb(4,51,255)">func</span> draw(<span style="color:rgb(4,51,255)">_</span> rect: <span style="color:rgb(52,149,175)">CGRect</span>) {</p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"> <span style="color:rgb(4,51,255)">self</span>.draw(inContext: currentGraphicsContext())</p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"> }</p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">}</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br></p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px">having said that, yes, i can see your point. my fear is that it will be (1) too fragile (e.g. you have "TableViewDelegate" in the ledger and just forgot to include the relevant file in the target - the app compiles but then misbehaves, and (2) open for abuse.</p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px"><br></p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px">alternative 1 - it's not too hard to put an empty:</p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px"><br></p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px">part Feature of SomeClass {}<br></p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px"><br></p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px">for the relevant platform<br></p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px"><br></p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px">alternative 2 - have this in the ledger:</p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px"><br></p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px">class Some {</p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px"> part Feature1</p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px"> optional part Feature2</p><p style="margin:0px;font-stretch:normal;line-height:normal;min-height:14px">}</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small"><br></span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small">as an "opt-in" to the behaviour you want.</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small"><br></span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small">i think this type of refinement can be done at some later stage. after all, we do not have even (much needed IMHO) optional protocol methods without resorting to @objc as of now...</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small"><br></span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small">Mike</span></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><span style="font-family:arial,sans-serif;font-size:small"><br></span></p></div></div></div>