Type Safely

Type Safely

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
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…

User's avatar

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

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