Soroush Khanlou 2/24/2025

Faking Value Semantics with Custom FormatStyles

Read Original

The article discusses the limitations of the old NSFormatter API and introduces Swift's new FormatStyle protocol. It provides a step-by-step tutorial on creating a custom OrdinalFormatStyle for locale-aware ordinal number formatting (e.g., "3rd"), including performance optimizations and handling shared formatter instances.

Faking Value Semantics with Custom FormatStyles

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week