Type Safely

Type Safely

Share this post

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

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

Share this post

Type Safely
Type Safely
Use The 'some' Keyword For Any Function Parameter That Conforms To a Protocol
Share
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…

Keep reading with a 7-day free trial

Subscribe to Type Safely to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Type Safely
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share