<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="">If you look at the implementation I provided, it allows for percentages higher than 100% (and has an easy way to clip them or map them to an arbitrary range).<div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 16, 2018, at 11:39 AM, Dave DeLong via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jan 16, 2018, at 9:56 AM, Jon Gilbert via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""><span class=""></span></div><div class="">No to this pitch, because a percentage can be higher than 100%.</div></div></div></blockquote><div class=""><br class=""></div><div class="">☝️ One need only look in Activity Monitor to see this in action.</div><br class=""><blockquote type="cite" class=""><div dir="auto" class=""><div class="">Use NumberFormatter to display a number as a percentage. <a href="https://developer.apple.com/documentation/foundation/numberformatter" class="">https://developer.apple.com/documentation/foundation/numberformatter</a></div></div></blockquote><div class=""><br class=""></div><div class="">I agree 1000% 😉 </div><br class=""><blockquote type="cite" class=""><div dir="auto" class=""><div class="">Or you could make an NSNumber subclass if you want to enforce an arbitrary rule upon numbers.</div></div></blockquote><div class=""><br class=""></div><div class="">In theory you can; in practice you can’t. Subclassing things like NSNumber is fraught with undocumented peril.</div><div class=""><br class=""></div><div class="">Dave</div></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=""></div></body></html>