How to implement a glassmorphic card in SwiftUI?

Uplift iOS Interview

"Uplift iOS Interview" is a comprehensive guide to help aspiring iOS developers soar to new heights in their careers. This book is an indispensable tool for anyone looking to crack the iOS interview and impress their future employers with their technical prowess. With in-depth coverage of Swift, AutoLayout, SwiftUI, Multithreading, Memory management so on and so forth, this book is a treasure trove of knowledge for anyone looking to uplift their iOS development career.

Glassmorphism is a popular design trend which provides stunning UI and UX for the user. You can find glassmorphic UI everywhere in apple’s design.

The most common way to achieve glassmorphic UI is by adding blur to the background, adding inner shadow, drop shadow as well as highlighting the border. After adding the blur effect whatever is behind the background is beautifully “morphed” into the element itself. Glassmorphic UI item really shines while using vividly coloured background.

A glassmorphic card is a design pattern that involves creating a transparent card with a reflection effect, similar to the look of a sheet of glass. To implement a glassmorphic card in SwiftUI, you can use the Card view provided by the SwiftUI framework and customize its appearance with the background(_:) and cornerRadius(_:) modifiers.

Here’s an example of how to create a glassmorphic card in SwiftUI:

struct GlassmorphicCard<Content>: View where Content: View {
  let content: Content

  var body: some View {
    Card {
    .shadow(color:, radius: 8, x: 0, y: 4)

In this example, the GlassmorphicCard view is a generic view that takes a Content parameter and displays it within a Card view. The background(_:) modifier is used to set the background color of the card to clear, which makes the card transparent. The cornerRadius(_:) modifier is used to round the corners of the card, and the shadow(color:radius:x:y:) modifier is used to add a drop shadow to the card to create the reflection effect.

To use the GlassmorphicCard view, you can pass it a view component as the Content parameter. This will create a transparent card with rounded corners and a reflection effect, containing the text “Hello, World!”. You can customize the appearance of the card further by adding additional modifiers or using custom styles. For example:

GlassmorphicCard {
  Text("Hello, World!")

Rev Up Your iOS Skills: Take a Dynamic Learning Journey
iOS Career Boost

iOS Career Boost is the ultimate learning journey to elevate your iOS development career through a dynamic blend of visual learning, handy cheat sheets, coding practice materials, and expertly curated tips and tricks

Get Ready to Shine: Mastering the iOS Interview

Enjoying the articles? Get the inside scoop by subscribing to my newsletter.

Get access to exclusive iOS development tips, tricks, and insights when you subscribe to my newsletter. You'll also receive links to new articles, app development ideas, and an interview preparation mini book. Your email address will only be used for the purpose of sending the newsletter and will not be shared with third parties or advertisers. Rest assured that we value your privacy and will not spam your inbox.

Connect with me on

Twitter and LinkedIn and don't hesitate to reach out with any questions about this post. Thank you for reading.

If you know someone who would benefit from reading this article, please share it with them.