ios – Embed FlutterViewController to Native Swift TabBar


I have a native iOS app written by Swift. I embedded another Flutter app into the native iOS app as a framework. When I searched everyone initialized FlutterViewController inside a native iOS ViewController.

BUT, I want to embed FlutterViewController to TabBar. When a designated tab is clicked the FlutterViewController should be pushed.

When I try to do that like this, the TabBar layout is breaking down. Even if there are only 5 tabs it becomes more form.

enter image description here

Also, I have an error message too.

Thread 1: "Inconsistency in UITabBar items and view controllers detected. No view controller matches the UITabBarItem '<UITabBarItem: 0x114e4a6a0> title="Order" image=<UIImage:0x6000030241b0 anonymous {24, 24} renderingMode=alwaysOriginal> selected'."

I am initiating the VC like this.

  lazy var orderController: FlutterViewController = {
    let controller = Order2ViewController(engine: AppDelegate.shared.flutterEngine, nibName: nil, bundle: nil)
    controller.tabBarItem = TabBarItem.order
    return controller
  }()

How could I embed a FlutterVC to native Swift TabBar? Or shouldn’t I do it. I don’t know the best practice?

I am expecting to figure out embed a FlutterVC to native Swift TabBar.

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img