如何在 swift 中圆我应用的 window 的角?

How do I round the corners of my app's window in swift?

我正在尝试在 swift 中绕过整个应用程序 window 的角落,例如现金应用程序或篝火。我该怎么做?

您可以在 AppDelegate 中完成 class

func applicationDidBecomeActive(_ application: UIApplication) {
    window?.layer.cornerRadius = 10
    window?.clipsToBounds = true
    window?.backgroundColor = .white
  }

如果您正在使用 SceneDelegate class 那么

func sceneDidBecomeActive(_ scene: UIScene) {


          window?.layer.cornerRadius = 110
          window?.clipsToBounds = true
          window?.backgroundColor = UIColor.black

        // Called when the scene has moved from an inactive state to an active state.
        // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
    }