Awesome solution! I was able to make the zoom button disable with your solution.This is my Swift version:I created a MacHelperBundle, created a Helper.swift:import AppKit
public class Helper {
/// Disable the zoom button for window.
/// - Parameter window: The window to disable.
@objc static func disableZoomButton(for window: NSWindow) {
window.standardWindowButton(.zoomButton)?.isEnabled = false
}
}In the app target func scene(_: UIScene, willConnectTo _: UISceneSession, options _: UIScene.ConnectionOptions) {
#if targetEnvironment(macCatalyst)
// ...
DispatchQueue.main.async { [weak self] in
guard let builtInPlugInsPath = Bundle.main.builtInPlugInsPath else {
return
}
let bundlePath = builtInPlugInsPath + "/MacHelperBundle.bundle"
guard let bundle = Bundle(path: bundlePath) else {
return
}
bundle.load()
guard let window = self?.window?.nsWindow else {
return
}
let macHelper = bundle.classNamed("MacHelperBundle.Helper") as AnyObject
_ = macHelper.perform(NSSelectorFromString("disableZoomButtonFor:"), with: window)
}
#endif
// ...
}
extension UIWindow {
/// Get the NSWindow from self.
var nsWindow: AnyObject? {
guard let nsWindows = NSClassFromString("NSApplication")?.value(forKeyPath: "sharedApplication.windows") as? [AnyObject] else { return nil }
for nsWindow in nsWindows {
let uiWindows = nsWindow.value(forKeyPath: "uiWindows") as? [UIWindow] ?? []
if uiWindows.contains(self) { return nsWindow }
}
return nil
}
}
Post
Replies
Boosts
Views
Activity
Setting the Architecture under Build Settings to arm64 works well:
To get valid architectures, in your project folder, run:
xcodebuild -project <Your project name>.xcodeproj -scheme "Your Project Scheme" -showBuildSettings | grep ARCHS
For my project, it prints:
ARCHS = arm64 x86_64
ARCHS_STANDARD = arm64 x86_64
ARCHS_STANDARD_32_64_BIT = arm64 x86_64 i386
ARCHS_STANDARD_32_BIT = i386
ARCHS_STANDARD_64_BIT = arm64 x86_64
ARCHS_STANDARD_INCLUDING_64_BIT = arm64 x86_64
VALID_ARCHS = arm64 arm64e i386 x86_64
This is where I got arm64 as the value.