<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"><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="">Hi,<div class=""><br class=""></div><div class="">I am new to the mailing list, and am interested in contributing to the swift project.</div><div class="">&nbsp;</div><div class="">I’ve been having a play with the ICU library’s unit formatting functions, and have created a simple wrapper that could be used by the various measurement formatters as well as the date component formatter. At the moment, this wrapper is written in swift, but I’m thinking it might make more sense to implement it as a core foundation layer, so as not to expose ICU directly to swift.</div><div class=""><br class=""></div><div class="">The interface for this could look something like:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">enum</span><span style="font-variant-ligatures: no-common-ligatures" class=""> CFUnitFormatterStyle{</span></div><p 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="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; CFUnitFormatterStyleLong,</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="">&nbsp; &nbsp; CFUnitFormatterStyleMedium,</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="">&nbsp; &nbsp; ...</span></div><p 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="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p><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><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" 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;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">enum</span><span style="font-variant-ligatures: no-common-ligatures" class=""> CFUnitFormatterUnit{</span></div><p style="margin: 0px; line-height: normal; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; CFUnitFormatterUnit_Length_Meter,</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; ...</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; CFUnitFormatterUnit_Mass_Gram,</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; ...</span></div><p style="margin: 0px; line-height: normal; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">};</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">struct</span><span style="font-variant-ligatures: no-common-ligatures" class=""> CFUnitFormatterMeasure{</span></div><p style="margin: 0px; line-height: normal; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">double</span><span style="font-variant-ligatures: no-common-ligatures" class=""> value;</span></div><div style="margin: 0px; line-height: normal; color: rgb(79, 129, 135);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures" class="">CFUnitFormatterUnit</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> unit;</span></div><p style="margin: 0px; line-height: normal; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">};</span></div></div></span></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">CFUnitFormatterRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> CFUnitFormatterCreate(</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CFAllocatorRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> allocator, </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CFLocaleRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> locale, </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">CFUnitFormatterStyle</span><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;style, </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CFNumberFormatterRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> numberFormatter);</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=""><br 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 style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CFStringRef</span> CFUnitFormatterCreateString(<span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CFAllocatorRef</span> allocator, <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">CFUnitFormatterRef</span> formatter, <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">double</span> value, <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">CFUnitFormatterUnit</span> unit);</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=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CFStringRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> CFUnitFormatterCreateStringWithMeasure(</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CFAllocatorRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> allocator, </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">CFUnitFormatterRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> formatter, </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">CFUnitFormatterMeasure</span><span style="font-variant-ligatures: no-common-ligatures" class=""> measure);</span></div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CFStringRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> CFUnitFormatterCreateStringWithMeasures(</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CFAllocatorRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> allocator, </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">CFUnitFormatterRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> formatter, </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CFArrayRef</span><span style="font-variant-ligatures: no-common-ligatures" class=""> measures);</span></div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class="">Looking for any thoughts and suggestions before I begin implementing this.</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">Henry</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">---</div><div style="margin: 0px; line-height: normal;" class="">Henry Betts</div><div style="margin: 0px; line-height: normal;" class=""><a href="http://henrybetts.co.uk" class="">henrybetts.co.uk</a></div></span></div></body></html>