SwiftUI App: How to hide title bar for macOS app?

Viewed 647

This is NOT a MacCatalyst app or SwiftUI macOS app. But an iOS app with macOS target(As shown below). I'm trying to hide the title bar of the macOS app in this setting.

enter image description here

  • .windowStyle(HiddenTitleBarWindowStyle()) will not work because this is not a traditional macOS app. Thus, the API is not available.

  • titlebar.titleVisibility = .hidden will not work because this is
    not a catalyst app. In addition, sceneDelegate does not exist in
    SwiftUI lifecycle.

I'm trying to look for a solution that works for the case of above screenshot. An iOS app with macOS 11+ as deployment target.

Some user points out that this is a MacCatalyst app. And I had closed the previous question. But after some testing, I can confirm this is indeed NOT MacCatalyst. It's a new way of running iOS app on Mac that is only available on Apple Silicon Mac. MacCatalyst target refers to the Rosetta approach only.

As shown on image below. My question is about hiding status bar on My Mac(Designed for iPad)

enter image description here

Testing code as below. MacCatalyst code only gets called on target Mac(Rosetta) enter image description here

New API related to my problem is ProcessInfo.processInfo.isiOSAppOnMac. I'm wondering how to hide title in this particular case.

0 Answers
Related