<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 class="">Lots of people have added their 2¢ now, you probably have about 10 dollars worth, but here goes.</div><div class=""><br class=""></div><div class="">While it looks nice and short, I think it has a range of drawbacks:</div><div class="">- It’s not a real type that can participate in protocols or extensions.</div><div class="">- Discourages DRY coding, because some people will think they are taking the easy way out, and even copy and paste this same declaration multiple times.</div><div class="">- Encourages adding subtypes to functions instead of types. Swift seems primarily type-focused more than function-focused. I remember seeing someone write their solution as an extension to UIImage, which was a nice way to do it. This subtype would be best conceptually as UIImage.FitOperation (use with multiple methods!) not scaleAndCropImage.Operation (use once!)</div><div class=""><br class=""></div><div class="">The beauty of Swift is that you can add methods to value types. This opens up interesting, more reusable solutions such as:</div><div class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; background-color: rgb(57, 57, 57);" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(215, 137, 59);" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(215, 137, 59);" class="">enum</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;ContentFit {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(215, 137, 59);" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;fit</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(215, 137, 59);" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;fill</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp;</span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(215, 137, 59);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;adjust(size contentSize:&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">CGSize</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, within bounds:&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">CGRect</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) -&gt;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">CGRect</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(215, 137, 59);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;(widthFactor, heightFactor) = (bounds.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">size</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">width</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;/ contentSize.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">width</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, bounds.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">size</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">height</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;/ contentSize.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">height</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; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(215, 137, 59);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;scaleFactor:&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">CGFloat</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(215, 137, 59);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(235, 231, 227);" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures;" class="">switch</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(235, 231, 227);" class="">&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures;" class="">self</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(235, 231, 227);" class="">&nbsp;{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(215, 137, 59);" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(194, 149, 185);" class="">fit</span><span style="font-variant-ligatures: no-common-ligatures;" class="">: scaleFactor =&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">min</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(widthFactor, heightFactor)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(215, 137, 59);" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(194, 149, 185);" class="">fill</span><span style="font-variant-ligatures: no-common-ligatures;" class="">: scaleFactor =&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">max</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(widthFactor, heightFactor)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(215, 137, 59);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;adjustedSize =&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">CGSize</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(width: contentSize.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">width</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;* scaleFactor, height: contentSize.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">height</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;* scaleFactor)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(215, 137, 59);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;adjustedOrigin =&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">CGPoint</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(x: (bounds.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">size</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">width</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;- adjustedSize.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">width</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) /&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(126, 170, 199);" class="">2.0</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, y: (bounds.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">size</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">height</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;- adjustedSize.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">height</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) /&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(126, 170, 199);" class="">2.0</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; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(215, 137, 59);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(211, 218, 255);" class="">CGRect</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(origin: adjustedOrigin, size: adjustedSize)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp;}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(235, 231, 227);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; background-color: rgb(57, 57, 57);" class=""><br class=""></div></div><div class=""><br class=""></div><div class="">That way you break functions up into smaller chunks, while also making the types more useful in themselves.</div><div class=""><br class=""></div><div class="">(For context, Erica’s original post is here:&nbsp;<a href="http://ericasadun.com/2016/05/31/swift-rewrite-challenge/" class="">http://ericasadun.com/2016/05/31/swift-rewrite-challenge/</a>)</div><div class=""><br class=""></div><div class="">Patrick</div><br class=""><div><blockquote type="cite" class=""><div class="">On 1 Jun 2016, at 2:16 AM, Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Here's a function signature from some code from today:<div class=""><br class=""></div><div class=""><table class="highlight js-file-line-container tab-size" data-tab-size="8" style="box-sizing: border-box; border-spacing: 0px; border-collapse: collapse; tab-size: 8; color: rgb(51, 51, 51); font-family: Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 13px;"><tbody style="box-sizing: border-box;" class=""><tr style="box-sizing: border-box;" class=""><td id="file-scalecrop-swift-LC6" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; vertical-align: top; overflow: visible; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">scaleAndCropImage</span>(</td></tr><tr style="box-sizing: border-box;" class=""><td id="file-scalecrop-swift-L7" class="blob-num js-line-number" data-line-number="7" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 18px; text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none; border-style: solid; border-color: rgb(238, 238, 238); border-width: 0px 1px 0px 0px;"></td><td id="file-scalecrop-swift-LC7" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; vertical-align: top; overflow: visible; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">    image: UIImage,</td></tr><tr style="box-sizing: border-box;" class=""><td id="file-scalecrop-swift-L8" class="blob-num js-line-number" data-line-number="8" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 18px; text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none; border-style: solid; border-color: rgb(238, 238, 238); border-width: 0px 1px 0px 0px;"></td><td id="file-scalecrop-swift-LC8" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; vertical-align: top; overflow: visible; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">    <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">toSize</span> <span class="pl-smi" style="box-sizing: border-box;">size</span>: CGSize,</td></tr><tr style="box-sizing: border-box;" class=""><td id="file-scalecrop-swift-L9" class="blob-num js-line-number" data-line-number="9" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 18px; text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none; border-style: solid; border-color: rgb(238, 238, 238); border-width: 0px 1px 0px 0px;"></td><td id="file-scalecrop-swift-LC9" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; vertical-align: top; overflow: visible; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">    <b class="">fitImage: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Bool</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">true</span></b></td></tr><tr style="box-sizing: border-box;" class=""><td id="file-scalecrop-swift-L10" class="blob-num js-line-number" data-line-number="10" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 18px; text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none; border-style: solid; border-color: rgb(238, 238, 238); border-width: 0px 1px 0px 0px;"></td><td id="file-scalecrop-swift-LC10" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; vertical-align: top; overflow: visible; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">    ) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> UIImage {</td></tr></tbody></table><div class=""><br class=""></div><div class=""><br class=""></div><div class="">And here's what I want the function signature to actually look like:</div></div><div class=""><br class=""></div><div class=""><table class="highlight js-file-line-container tab-size" data-tab-size="8" style="box-sizing: border-box; border-spacing: 0px; border-collapse: collapse; tab-size: 8; color: rgb(51, 51, 51); font-family: Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 13px;"><tbody style="box-sizing: border-box;" class=""><tr style="box-sizing: border-box;" class=""><td id="file-scalecrop-swift-LC6" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; vertical-align: top; overflow: visible; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">scaleAndCropImage</span>(</td></tr><tr style="box-sizing: border-box;" class=""><td id="file-scalecrop-swift-L7" class="blob-num js-line-number" data-line-number="7" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 18px; text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none; border-style: solid; border-color: rgb(238, 238, 238); border-width: 0px 1px 0px 0px;"></td><td id="file-scalecrop-swift-LC7" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; vertical-align: top; overflow: visible; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">    image: UIImage,</td></tr><tr style="box-sizing: border-box;" class=""><td id="file-scalecrop-swift-L8" class="blob-num js-line-number" data-line-number="8" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 18px; text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none; border-style: solid; border-color: rgb(238, 238, 238); border-width: 0px 1px 0px 0px;"></td><td id="file-scalecrop-swift-LC8" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; vertical-align: top; overflow: visible; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">    <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">toSize</span> <span class="pl-smi" style="box-sizing: border-box;">size</span>: CGSize,</td></tr><tr style="box-sizing: border-box;" class=""><td id="file-scalecrop-swift-L9" class="blob-num js-line-number" data-line-number="9" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 18px; text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none; border-style: solid; border-color: rgb(238, 238, 238); border-width: 0px 1px 0px 0px;"></td><td id="file-scalecrop-swift-LC9" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; vertical-align: top; overflow: visible; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">    <b class="">operation: <font color="#0086b3" class="">(.Fit | .Fill)</font> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> .<font color="#0086b3" class="">Fit</font></b></td></tr><tr style="box-sizing: border-box;" class=""><td id="file-scalecrop-swift-L10" class="blob-num js-line-number" data-line-number="10" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 18px; text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; -webkit-user-select: none; border-style: solid; border-color: rgb(238, 238, 238); border-width: 0px 1px 0px 0px;"></td><td id="file-scalecrop-swift-LC10" class="js-file-line blob-code-inner blob-code" style="box-sizing: border-box; padding: 0px 10px; position: relative; vertical-align: top; overflow: visible; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; word-wrap: normal; white-space: pre;">    ) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> UIImage {</td></tr></tbody></table><div class=""><br class=""></div></div><div class=""><br class=""></div><div class="">where I don't have to establish a separate enumeration to include ad-hoc enumeration-like semantics for the call. A while back, Yong hee Lee introduced anonymous enumerations (and the possibility of anonymous option flags) but the discussion rather died.</div><div class=""><br class=""></div><div class="">I'm bringing it up again to see whether there is any general interest in pursuing this further as I think the second example is more readable, appropriate, and Swifty than the first, provides better semantics, and is more self documenting.</div><div class=""><br class=""></div><div class="">Thanks for your feedback,</div><div class=""><br class=""></div><div class="">-- Erica</div><div class=""><br class=""></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>