swiftapple-watchwatchosiphone-privateapi

How to hide the digital time on watchOS 10?


Before watchOS 10, I can hide the digital time on the status bar by this:


let app = Dynamic.PUICApplication.sharedPUICApplication()

app._setStatusBarTimeHidden(true, animated: false, completion: nil)

But this private API is no longer take effect on watchOS 10+. Does there any other API to hide the time?


Solution

  • We can hide the digital time by SwiftUI like this:

    struct MyView: View {
        var body: some View {
            Text("Hello, World!")
                ._statusBarHidden()
        }
    }
    

    View._statusBarHidden(_: Bool = true)