I am working on a library for iOS, and i need to know if the application using the library is running SwiftUI or not so that i can handle things appropriately.
Is there a way to find this out programmatically in Objective-C?
In the end i did this.
Get the root or key window of the application.
Check if it's class name contains "UIHostingController"
Also nil check for this: NSClassFromString(@"SwiftUI._UIGraphicsView")
You could also check for other swift ui classes but this has covered all cases so far.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.