How to achieve a frosted glass label effect like iOS 26 system
11:26 19 Nov 2025

enter image description here

I want to create a label like my upload img` time label I have searched through the iOS documentation and did not find any relevant information. How should I write the code? By the way, I am using Uikit instead of uiswfit

Thank you for any help

Here are my attempts, but the results are different from those of the system

 super.viewDidLoad()
        // 渐变背景
        let gradientLayer = CAGradientLayer()
        gradientLayer.frame = view.bounds
        gradientLayer.colors = [
            UIColor.systemPurple.cgColor,
            UIColor.systemBlue.cgColor
        ]
        view.layer.insertSublayer(gradientLayer, at: 0)

        // 创建液态玻璃效果视图
        let glassEffectView = UIVisualEffectView(frame: CGRect(x: 0,
                                                               y: 100,
                                                               width: 400,
                                                               height: 100))
        if #available(iOS 26.0, *) {
            let glassEffect = UIGlassEffect()
            glassEffectView.effect = glassEffect
            view.addSubview(glassEffectView)

            // 创建文字标签作为遮罩
            let timeLabel = UILabel(frame: glassEffectView.bounds)
            timeLabel.text = "14:26"
            timeLabel.font = UIFont.systemFont(ofSize: 120, weight: .bold)
            timeLabel.textAlignment = .center
            timeLabel.textColor = .black
            timeLabel.backgroundColor = .clear

            glassEffectView.mask = timeLabel
        } else {
            // Fallback on earlier versions
        }
       
     
    }
swift uikit