Type Safely

Type Safely

Share this post

Type Safely
Type Safely
Using The Same Shape For a Button's Mask and Outline

Using The Same Shape For a Button's Mask and Outline

Daily Coding Tip 064

Millie Sturgeon's avatar
Millie Sturgeon
Apr 17, 2022
∙ Paid

Share this post

Type Safely
Type Safely
Using The Same Shape For a Button's Mask and Outline
Share
Image by Mariya 🌸🌺🌼 from Pixabay

By using the some Shape opaque return type, we can return shapes that can be used for multiple purposes. The same code would not work if it was some View, as views themselves cannot be used as masks. Although what we’re doing here has a similar effect to setting cornerRadius to 10, the masking shape can be any custom s…

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