Type Safely

Type Safely

Use The New Type Placeholder Declaration With Underscores

Daily Coding Tip 120

Millie Sturgeon's avatar
Millie Sturgeon
Jun 29, 2022
∙ Paid
Share
Image by sharkolot from Pixabay

There’s actually a way to specify a type you want Swift to infer.

When you initialise a new variable with "Hello world", it is not necessary to specify that it will be a string. Swift will infer that this is the type you want from the fact that you have initialised it with a string literal.

I have a simple enum with cases c…

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