<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><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I have two suggested “improvements”</div><div class=""><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">1) Make the enum String raw-representable. Name it somehow. This does not affect Erica’s original syntax.</div><div style="margin: 0px; line-height: normal;" class="">2) Force an explicit name.</div></div></div></div></blockquote></div></div></blockquote><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal; color: rgb(135, 78, 254);" class=""><span style="color: #b92d5d" class="">class</span><span style="" class=""> </span>MyImage<span style="" class=""> {</span></div><div style="margin: 0px; line-height: normal; color: rgb(135, 78, 254);" class=""><span style="" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #b92d5d" class="">func</span><span style="" class=""> </span>scaleAndCropImage<span style="" class="">(</span></div><div style="margin: 0px; line-height: normal;" class=""> <span class="Apple-tab-span" style="white-space:pre">                </span>image: UIImage,</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>toSize size: CGSize,</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>operation: <span style="color: rgb(135, 78, 254);" class="">ScaleCropFitFill</span>{ .<span style="line-height: normal; font-family: Menlo; -webkit-font-kerning: none; color: rgb(0, 134, 179);" class=""><b class="">Fit</b></span> | <span style="line-height: normal; font-family: Menlo; -webkit-font-kerning: none; color: rgb(0, 134, 179);" class=""><b class="">Fill</b></span>} = .<span style="line-height: normal; font-family: Menlo; -webkit-font-kerning: none; color: rgb(0, 134, 179);" class=""><b class="">Fit</b></span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""> <span class="Apple-tab-span" style="white-space:pre">        </span>) -> UIImage {…}</div><div style="margin: 0px; line-height: normal;" class="">}</div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">would be equivalent to:</div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal; color: rgb(135, 78, 254);" class=""><span style="color: #b92d5d" class="">class</span><span style="" class=""> </span>MyImage<span style="" class=""> {</span></div><div style="margin: 0px; line-height: normal; color: rgb(135, 78, 254);" class=""><span style="" class=""> <span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #b92d5d" class="">enum</span><span style="" class=""> </span>ScaleCropFitFill<span style="" class=""> {</span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>case <span style="line-height: normal; font-family: Menlo; -webkit-font-kerning: none; color: rgb(0, 134, 179);" class=""><b class="">Fit</b></span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>case <span style="line-height: normal; font-family: Menlo; -webkit-font-kerning: none; color: rgb(0, 134, 179);" class=""><b class="">Fill</b></span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>} </div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal; color: rgb(135, 78, 254);" class=""><span style="" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #b92d5d" class="">func</span><span style="" class=""> </span>scaleAndCropImage<span style="" class="">(</span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>image: UIImage,</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>toSize size: CGSize,</div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>operation: <span style="color: #874efe" class="">ScaleCropFitFill</span> = .<span style="line-height: normal; font-family: Menlo; -webkit-font-kerning: none; color: rgb(0, 134, 179);" class=""><b class="">Fit</b></span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>) -> UIImage {…}</div><div style="margin: 0px; line-height: normal;" class="">}</div></div></div></div></blockquote></div></div></blockquote><br class=""></div><div>This is not the direction I'm hoping to move in.</div><div><br class=""></div><div>If an enumeration is to be used in more than one place, it should be a proper enumeration. Swift already offers dependent type support. Single-point ad-hoc enumerations create better semantics for moving from if statements that test on Boolean values to switch statements that test on phrases, without creating dependencies on other types. As Tony A points out, </div><div><br class=""></div><div><blockquote type="cite" class=""><span style="font-family: Palatino-Roman;" class="">Having argument labels solves some of the problems that come along with boolean arguments, but "fitImage" is a great example where the false case ("not fit?") doesn't really convey enough information (or can convey misleading information).</span></blockquote></div><div><span style="font-family: Palatino-Roman;" class=""><br class=""></span></div><div>-- E</div><div><br class=""></div></body></html>