If you not build with macCatalyst, just run the iOS app on the macOS, that you can use runtime to fix this issue.
if let titlebar = windowScene.value(forKey: "titlebar") as? NSObject {
let toolbarClass = NSClassFromString("NSToolbar") as! NSObject.Type
let allocSelector = NSSelectorFromString("alloc")
let initSelector = NSSelectorFromString("init")
let instance = toolbarClass.perform(allocSelector).takeUnretainedValue()
let toolbar = instance.perform(initSelector).takeUnretainedValue() as! NSObject
titlebar.setValue(toolbar, forKey: "toolbar")
titlebar.setValue(1, forKey: "titleVisibility")
titlebar.setValue(4, forKey: "toolbarStyle")
}
and make tabbar controller
if #available(iOS 17, *) {
traitOverrides.horizontalSizeClass = .compact
}
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: