How to add a liquid glass chat input bar what framework give me example code how to do it

Asked on 06/11/2025

1 search

To add a Liquid Glass chat input bar, you can use the new design system introduced by Apple, which includes Liquid Glass as a key material. Depending on the framework you are using, the approach will vary slightly. Here are some examples based on the context provided:

AppKit

For an AppKit app, you can use the NSGlassEffectView API to create Liquid Glass elements. Here's a basic example:

let glassEffectView = NSGlassEffectView()
glassEffectView.contentView = yourChatInputView
glassEffectView.cornerRadius = 10
glassEffectView.tintColor = .systemBlue

This code snippet creates a glass effect view and sets your chat input view as its content. You can customize the appearance using properties like cornerRadius and tintColor.

SwiftUI

In SwiftUI, you can use the glossEffect modifier to apply a Liquid Glass effect to your custom views:

struct ChatInputView: View {
    var body: some View {
        TextField("Type a message...", text: $message)
            .padding()
            .background(Color.white)
            .cornerRadius(10)
            .glossEffect()
    }
}

This example shows how to apply a gloss effect to a text field, which can be part of your chat input bar.

UIKit

For UIKit, you can create a UIVisualEffectView with a custom glass effect:

let visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .systemMaterial))
visualEffectView.contentView.addSubview(yourChatInputView)
visualEffectView.layer.cornerRadius = 10
visualEffectView.clipsToBounds = true

This code snippet demonstrates how to create a visual effect view with a blur effect that mimics Liquid Glass, and then add your chat input view to it.

For more detailed guidance, you can refer to the session Build an AppKit app with the new design (17:43) or Build a SwiftUI app with the new design (17:29) for examples on adopting Liquid Glass in your app.

How to add a liquid glass chat input bar what framework give me example code how to do it | Ask WWDC