home.social

#bytecountformatstyle — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #bytecountformatstyle, aggregated by home.social.

  1. The only usable ByteCountFormatStyle is decimal

    Swift makes it relatively easy to format numbers as byte counts, with appropriate suffixes to indicate units and generally sensible auto-selection of scale factors. e.g.:

    1234.formatted(.byteCount(style: .decimal))

    1 kB(in English - results may vary depending on locale)

    This is just a small subset of Swift's FormatStyle-based formatting capabilities, with which I have a bit of a love-hate relationship even when they're working correctly.

    Alas, they don't always work correctly; some of [...]

    wadetregaskis.com/the-only-usa

  2. The only usable ByteCountFormatStyle is decimal

    Swift makes it relatively easy to format numbers as byte counts, with appropriate suffixes to indicate units and generally sensible auto-selection of scale factors. e.g.:

    1234.formatted(.byteCount(style: .decimal))

    1 kB(in English - results may vary depending on locale)

    This is just a small subset of Swift's FormatStyle-based formatting capabilities, with which I have a bit of a love-hate relationship even when they're working correctly.

    Alas, they don't always work correctly; some of [...]

    wadetregaskis.com/the-only-usa

  3. The only usable ByteCountFormatStyle is decimal

    Swift makes it relatively easy to format numbers as byte counts, with appropriate suffixes to indicate units and generally sensible auto-selection of scale factors. e.g.:

    1234.formatted(.byteCount(style: .decimal))

    1 kB(in English - results may vary depending on locale)

    This is just a small subset of Swift's FormatStyle-based formatting capabilities, with which I have a bit of a love-hate relationship even when they're working correctly.

    Alas, they don't always work correctly; some of [...]

    wadetregaskis.com/the-only-usa

  4. Fucking FormatStyle

    I have a bit of a love-hate relationship with Swift's FormatStyle-based formatting capabilities.

    Text(progress.formatted(.percent.precision(.significantDigits(2))))

    42%(in English - results may vary depending on locale)

    On the pro side:

    They're better than rolling your own formatting. Not just in terms of convenience, but in terms of correctness - they support localisation, for example. "42%" in English, "٤٢٪؜" in العربية (Arabic), "৪২%" in ?

    সমীয়া [...]

    wadetregaskis.com/fucking-form

  5. Fucking FormatStyle

    I have a bit of a love-hate relationship with Swift's FormatStyle-based formatting capabilities.

    Text(progress.formatted(.percent.precision(.significantDigits(2))))

    42%(in English - results may vary depending on locale)

    On the pro side:

    They're better than rolling your own formatting. Not just in terms of convenience, but in terms of correctness - they support localisation, for example. "42%" in English, "٤٢٪؜" in العربية (Arabic), "৪২%" in ?

    সমীয়া [...]

    wadetregaskis.com/fucking-form

  6. Fucking FormatStyle

    I have a bit of a love-hate relationship with Swift's FormatStyle-based formatting capabilities.

    Text(progress.formatted(.percent.precision(.significantDigits(2))))

    42%(in English - results may vary depending on locale)

    On the pro side:

    They're better than rolling your own formatting. Not just in terms of convenience, but in terms of correctness - they support localisation, for example. "42%" in English, "٤٢٪؜" in العربية (Arabic), "৪২%" in ?

    সমীয়া [...]

    wadetregaskis.com/fucking-form