-
-
Save imWildCat/6c74ee153e1be65c42edbf110757dc50 to your computer and use it in GitHub Desktop.
Change the window scale factor in a Mac Catalyst app with the help of Dynamic (https://github.com/mhdhejazi/Dynamic)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidAppear(_ animated: Bool) { | |
view.window?.scaleFactor = 1.0 // Default value is 0.77 | |
} | |
extension UIWindow { | |
var scaleFactor: CGFloat { | |
get { | |
Dynamic.NSApplication.sharedApplication | |
.windows.firstObject.contentView | |
.subviews.firstObject.scaleFactor ?? 1.0 | |
} | |
set { | |
Dynamic.NSApplication.sharedApplication | |
.windows.firstObject.contentView | |
.subviews.firstObject.scaleFactor = newValue | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment