Last active
November 6, 2019 23:51
-
-
Save johnno1962/840cf2f58420d0a4ebdad7b237e43186 to your computer and use it in GitHub Desktop.
SwiftUI Injection
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
// First, install InjectionIII.app from the Mac AppStore | |
// https://apps.apple.com/us/app/injectioniii/id1380446739?mt=12 | |
// Make these changes to your code: | |
// add the following to application(didFinishLaunchingWithOptions:) | |
#if DEBUG | |
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load() | |
#endif | |
// Add this code to the end of your SwiftUI ContentView source | |
// using the UIHostingViewController from your Scene delegate. | |
class Refresher { | |
@objc class func injected() { | |
UIApplication.shared.windows.first?.rootViewController = | |
UIHostingController(rootView: ContentView()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment