flutter / samples

A collection of Flutter examples and demos

Home Page:https://flutter.github.io/samples/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[add-to-app] Add FlutterView to iOS sample and documentation missing

reytum opened this issue · comments

Hi All,

I have a requirement where we are migrating our native apps to flutter. We need to replace certain views in our native apps with flutter apps. For Android I can see the documentation and sample, but its not available for iOS. So, is the flutter view missing integration for iOS or the documentation and samples are not available? If so, is there any workaround for it?

Add to app is supported on iOS. Please see https://docs.flutter.dev/development/add-to-app#add-to-ios-applications for documentation.

@domesticmouse Thanks for your reply. This document only mentions how to add a flutter screen to your existing iOS app. What I am looking for is combination of native and flutter views inside my native ViewController. For e.g in Android I am able to add a FlutterView in my Activity alongside native views. Here is the android documentation for the same: https://docs.flutter.dev/development/add-to-app/android/add-flutter-view. What I am interested is a similar documentation or sample for iOS.

Hey @gaaclarke, can we document this use case?

Ahh I understand. We don't have documentation explicitly explaining how to do this, but it is shown inside of our sample code: https://github.com/flutter/samples/blob/main/add_to_app/multiple_flutters/multiple_flutters_ios/MultipleFluttersIos/DoubleFlutterViewController.swift

The gist is that a FlutterViewController has a view property that you can embed into a different UIView.

@gaaclarke Thanks for your reply. However, I still couldn't find the exact implementation of the view inside https://github.com/flutter/samples/blob/main/add_to_app/multiple_flutters/multiple_flutters_ios/MultipleFluttersIos/DoubleFlutterViewController.swift. Could you please point me to the exact code where we are adding a flutter view to native ViewController?
I would like to embed a FlutterVIew inside my existing UiViewController. The view property of FlutterViewController is accessible only if I subclass my ViewController with FlutterViewController.

@domesticmouse @gaaclarke Thanks, I was able to integrate flutter views into iOS UITableView by using the view property of FlutterViewController. Is there a same documentation for integrating flutter View into existing Web and PWA apps?

@domesticmouse @gaaclarke Thanks. Was able to integrate FlutterView using the view property of the FLutterViewController into UITableView using multiple reusable engines. This fulfils my use case.