<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="margin: 0px; line-height: normal;" class="">I am almost not sure if this is a joke or not. That is an incredibly complicated looking hieroglyphic to dispatch a bit of code. I do this:</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">- (</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">void</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)prepareForSegue:(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">UIStoryboardSegue</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> *)segue sender:(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">id</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)sender {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">NSString</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">* message = [</span><span style="font-variant-ligatures: no-common-ligatures;" class="">NSString</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);" class="">stringWithFormat</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(209, 47, 27);" class="">@"prepareSeque%@To%@:"</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">,(segue.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">identifier</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> ? segue.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">identifier</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(209, 47, 27);" class="">@""</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">), [segue.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">destinationViewController</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);" class="">class</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">]];</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">SEL</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> method = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);" class="">NSSelectorFromString</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(message);</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(62, 30, 129);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">if</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">([</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">respondsToSelector</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">:method])</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> [</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);" class="">performSelector</span><span style="font-variant-ligatures: no-common-ligatures;" class="">:method </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);" class="">withObject</span><span style="font-variant-ligatures: no-common-ligatures;" class="">:segue.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">destinationViewController</span><span style="font-variant-ligatures: no-common-ligatures;" class="">];</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">// Assume segue identifier was NextStep and we are going to a NextViewController</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">-(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">void</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)prepareSequeNextStepToNextViewController:(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">NextViewController</span><span style="font-variant-ligatures: no-common-ligatures;" class="">*)vc</span></div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">// do specific work in a small focused method instead of buried in a giant ugly switch statement</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div class="">Burying all that logic in a bunch of control statements just obfuscates intent. Now, you may argue my prepareForSegue is a little bit ugly and I would agree with you - but I write that once, stick it on UIViewController as an extension method, and never look at it again, instead going off the naming convention - much like the responder chain works.</div><div class=""><br class=""></div><div class="">I keep hearing the same justifications over and over. "Compiler can't check that", "pattern matching", "powerful enums", "protection from nil", "faster execution", "exhaustively checked switch statements" etc.... I do not value any of that stuff and it all goes out the window once your program beings consuming data from outside. It doesn't make my programs more powerful, more expressive, more robust, or better. It does slow me down a lot trying to satisfy a bunch of constraints that are, frankly, irrelevant to my problem domain and what it does instead is refocus my attention from the problem domain into the implementation domain unnecessarily.</div><div class=""><br class=""></div><div class="">The conventional wisdom is that switch statements are an anti pattern in the presence of OO features. They're brittle and basically they're goto's. Polymorphism is to be preferred. I thought we settled that in the 90s.</div><div class=""><br class=""></div><div class="">It is becoming more and more clear that the ideals of Swift are nothing like the Smalltalk ideals that gave us Cocoa (and Cocoa is a very elegant framework loaded with beautiful design patterns that have served us very well - well enough to let little Apple eat Microsoft's lunch). Swift is a lot closer to the ideals of C++ and ML and they are a terrible fit on top of a Smalltalk inspired framework. Write Swift if you must - but stop screwing up the Apple app scene with it.</div><div class=""><br class=""></div><div class="">Seriously, I'm out. I'd just like to ask the Apple people to stop dumping cruft into the Objective C header files. I don't care about nullable annotations or the fake generics cruft. Objective C is based on Smalltalk. This direction is anathema to the Smalltalk ideals that underly the existing Cocoa system. Nils don't matter and generics are nonsense in a dynamically typed world. I mean, have any of you even used a book on Smalltalk as a doorstop much less read one?</div><div class=""><br class=""></div><div class="">Basically, you're killing the golden goose. Like when WebObjects was ported to Java. It didn't survive the change from dynamic language to more rigid type constrained Java language. It just died.</div><div class=""><br class=""></div><div class="">Cocoa won't either.</div><div class=""><br class=""></div><div class="">I'm signing off this list. Swift is about the opposite of what I need in a programming language. It will not scale to the enterprise any better than C++ did (clue - it didn't - I was there) and the embedded world has already had working Smalltalk implementations all the way down to fpga's (<a href="http://ieeexplore.ieee.org/document/564744/" class="">http://ieeexplore.ieee.org/document/564744/</a>) for over 20 years so I'm completely unpersuaded by the efficiency arguments or the compiler checked "correctness" arguments. Software is never correct, never done, never perfect. Best to have an environment that can deal with that.</div><div class=""><br class=""></div><div class="">Oh and uh - stop pushing Swift as the future. 9/10 jobs doing iOS now demand Swift. Thanks for that. And by thanks - I mean screw you, Apple. State of iOS development today is a disaster.</div><div class=""><br class=""></div><div class="">Out.</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Jan 11, 2017, at 00:04, André Videla <<a href="mailto:andre.videla@gmail.com" class="">andre.videla@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><span class="pl-k" style="box-sizing: border-box;">func</span><span class="Apple-converted-space"> </span><span class="pl-en" style="box-sizing: border-box;">prepareFor<span style="box-sizing: border-box; padding: 2px; margin: 0px -2px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Segue</span></span>(<span class="pl-en" style="box-sizing: border-box;"><span class="pl-smi" style="box-sizing: border-box;"><span style="box-sizing: border-box; padding: 2px; margin: 0px -2px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">segue</span></span></span>: UIStoryboard<span style="box-sizing: border-box; padding: 2px; margin: 0px -2px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Segue</span>,<span class="Apple-converted-space"> </span><span class="pl-en" style="box-sizing: border-box;"><span class="pl-smi" style="box-sizing: border-box;">sender</span></span>:<span class="Apple-converted-space"> </span><span class="pl-c1" style="box-sizing: border-box;">Any</span><span class="pl-k" style="box-sizing: border-box;">?</span>) {</span></div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> Switch (segue.identifier, segue.destination, sender) {</div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> Case ("Segue"?, let vc as FirstVC, .some(.enumType(let value)) ): // prepare the vc</div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> ... // other segues</div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> }</div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">}</div></div></blockquote></div><br class=""></body></html>