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 |
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
| // macOS App | |
| let panel = NSOpenPanel() | |
| panel.beginSheetModal(for: view.window!, completionHandler: { response in | |
| if let url: URL = panel.urls.first { | |
| print("url: ", url) | |
| } | |
| }) | |
| // Mac Catalyst (with Dynamic) | |
| let panel = Dynamic.NSOpenPanel() |
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
| // macOS App | |
| NSApplication.shared | |
| .windows.first? | |
| .toggleFullScreen(nil) | |
| // Mac Catalyst (with Dynamic) | |
| Dynamic.NSApplication.sharedApplication | |
| .windows.firstObject | |
| .toggleFullScreen(nil) |
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
| extension UIWindow { | |
| var nsWindow: NSObject? { | |
| Dynamic.NSApplication.sharedApplication.delegate.hostWindowForUIWindow(self) | |
| } | |
| } |
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
| function asanaRequest($methodPath, $httpMethod = 'GET', $body = null) | |
| { | |
| $apiKey = 'ASANA_API_KEY_HERE'; /// Get it from http://app.asana.com/-/account_api | |
| $url = "https://app.asana.com/api/1.0/$methodPath"; | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ; | |
| curl_setopt($ch, CURLOPT_USERPWD, $apiKey); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |