beauchette
beauchette

Reputation: 1124

Flutter swift plugin creating and showing an arbitrary UIViewController

I'd like to show a swift UIViewController in a flutter app. So far, I successfully :

Now, inside this plugin, I can instantiate my CustomViewController, but I have no way to show it on screen, because I'm writing a FlutterPlugin, and it obviously doesn't have any of the facilities like self.window, self.present, etc. How can I do that ?

Upvotes: 0

Views: 479

Answers (1)

Slah Layouni
Slah Layouni

Reputation: 740

You can get the current rootController from the keyWindow and present your custom view controller from there.

UIApplication.shared.keyWindow?.rootViewController?.present(...

Upvotes: 4

Related Questions