Type Safely

Type Safely

Use The 'some' Keyword For Any Function Parameter That Conforms To a Protocol

Daily Coding Tip 119

Millie Sturgeon's avatar
Millie Sturgeon
Jun 29, 2022
∙ Paid
Image by Kevin Schwarz from Pixabay

Here’s a simple protocol that requires a type to have a string property called spelled. This means I want a numeric type that conforms to this to be able to spell out the word name for that number, for instance ‘one’ or ‘two’. Luckily there’s a fairly easy way to conform to this protocol by using a NumberFormatter, whi…

User's avatar

Continue reading this post for free, courtesy of Type Safely.

Or purchase a paid subscription.
© 2025 Type Safely · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture