how can I make my custom component glass

Asked on 2025-07-03

1 search

To create a custom component with a glass effect, you can use the new Liquid Glass material introduced in UIKit. Here are the steps to achieve this:

  1. Create a UI Visual Effect View: This will serve as the base for your glass effect.

  2. Apply the Glass Effect: Use the new UI glass effect in an animation block to make the glass appear with a special materialized animation. By default, the glass is in a capsule shape, but you can customize the shape using the new corner configuration API.

  3. Customize Appearance: The glass effect adapts to the selected user interface style, automatically switching between light and dark appearances. You can also customize the corner radius to adapt to the container's corners.

  4. Interactive Elements: For interactive elements like buttons, set isInteractive to true on the glass effect to enable scaling and bouncing interactions.

  5. Use a Glass Container: If you have multiple glass elements, use a UI Glass Container Effect to dynamically merge glass views and ensure they blend seamlessly.

For a detailed guide on building custom Liquid Glass elements, you can refer to the session Build a UIKit app with the new design (19:15).