This file contains 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
// keyWindow | |
- UIApplication.shared.keyWindow | |
+ UIApplication.shared.windows.first { $0.isKeyWindow } | |
// alt via Scenes | |
- UIApplication.shared.keyWindow | |
+ UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.flatMap { $0.windows }.first { $0.isKeyWindow } | |
// statusBarFrame | |
- UIApplication.shared.statusBarFrame |
This file contains 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
import Foundation | |
// long running code | |
while RunLoop.main.run(mode: .default, before: .distantFuture) {} |
This file contains 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
import Foundation | |
import PlaygroundSupport | |
// long running code | |
PlaygroundPage.current.needsIndefiniteExecution = true |
This file contains 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
// silgen allows you to call C functions without headers or bridges | |
// not to be used as a rulem but might have some interesting use cases | |
@_silgen_name("getpid") private func getpid() -> pid_t | |
print(getpid()) |
This file contains 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
import Foundation | |
import Combine | |
// register the observable name | |
extension Notification.Name { | |
static let DemoObservable = Notification.Name("DemoObservable") | |
} | |
// define the observable value type | |
struct DemoValue { |