UIVisualEffectView with UIGlassEffect with only 2 rounded corners

Trying to make a sheet-like view that attaches at the bottom to another view so I'd like to have only the top two corners rounded.

This works for a blurred effect:

let glassView = UIVisualEffectView(effect: UIBlurEffect(style: .systemMaterial))
glassView.layer.cornerRadius = 20
glassView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner]
glassView.layer.masksToBounds = true

but if I try to use the iOS 26 UIGlassEffect, all 4 corners become rounded:

let glassView = UIVisualEffectView(effect: UIGlassEffect())
glassView.layer.cornerRadius = 20
glassView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner]
glassView.layer.masksToBounds = true
Answered by massimobio in 866771022

Found the solution: UIView has a new cornerRadius property in iOS 26 that you can use instead of layer: glassView.cornerConfiguration = .uniformTopRadius(20)

Accepted Answer

Found the solution: UIView has a new cornerRadius property in iOS 26 that you can use instead of layer: glassView.cornerConfiguration = .uniformTopRadius(20)

UIVisualEffectView with UIGlassEffect with only 2 rounded corners
 
 
Q