Skip to content

Instantly share code, notes, and snippets.

@jenox
Last active June 20, 2022 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jenox/15d3bac5f66009c0349dda8df2f22681 to your computer and use it in GitHub Desktop.
Save jenox/15d3bac5f66009c0349dda8df2f22681 to your computer and use it in GitHub Desktop.
import Swift
extension UIApplication {
@discardableResult
public static func launch(with delegateClass: UIApplicationDelegate.Type) -> Int32 {
let type = UnsafeMutablePointer<Int8>.self
let count = Int(CommandLine.argc)
let principalClassName = NSStringFromClass(self)
let delegateClassName = NSStringFromClass(delegateClass)
return CommandLine.unsafeArgv.withMemoryRebound(to: type, capacity: count, {
UIApplicationMain(Int32(count), $0, principalClassName, delegateClassName)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment