Author: Tencent NOW Live – MirageQLiu

preface

Tencent Now Live iOS App has embedded the development module of Flutter function in the recent version. This paper aims to discuss our Now live terminal team’s thoughts and practices on the mixed development mode of iOS Flutter. We welcome your discussion. On the whole, the team has gone through three stages of mixed development mode, namely, Xcode engineering integration Flutter output mode, Flutter engineering integration Xcode engineering mode and multi-team collaboration remote construction output integration mode.

Flutter standard engineering structure

Let’s start with the standard iOS Construction of a Flutter project. The Flutter project contains an Xcode project that depends on the output of the Flutter project. Including App. Framework, Flutter. Framework, Flutter_assets, etc.

The Xcode project integrates the Flutter output pattern

Based on the principle that the Xcode project only relies on the Flutter project output, in order to respond to the need for quick launch of the product, we developed and debugged the Dart code in the independent Flutter project, and directly integrated the Flutter compilation output into the Now project in a dynamic library.

The Flutter project integrates the Xcode project pattern

In view of the defects of the above development mode, we changed our thinking to take the Flutter project as the main body and integrated the Xcode project into the Flutter project. Meanwhile, we adjusted the main Xcode directory and modified the parameters of the build script, so that the development environment could release packages normally. Under this development mode, we support three development methods at the same time: 1) Version requirements only need to modify the Native part and directly open the Xcode project for development; 2) Version requirements only need to modify the Flutter part and directly open the Flutter project using AndroidStudio; 3) Mixed debugging development mode. This version requires modification of both the Flutter and Native code, as well as support for Flutter Native breakpoint debugging

1) AndroidStudio starts the debug of the Flutter project and hangs breakpoint on the entry of the Flutter project



Multiple teams collaborate to remotely build output patterns

In order to highlight the advantages of a single piece of Flutter code supporting iOS/Android, we finally considered a solution to separate the Flutter code and submit it to the specified Xcode/Android branch directory automatically compiled by the RDM machine. First, the compilation machine with the Flutter environment was locally configured to mount and map to the RDM. Scheduled tasks were started on this machine. When code updates were detected on the SVN, compilation was automatically started and the outputs were respectively submitted to the corresponding Xcode/Android project SVN. We marked the upstream branch and revision version information in the submitted Flutter outputs so that the corresponding version code could be easily found later. The SVN code base consists of three main and branch versions of Flutter, iOS, and Android, respectively.

The development requirements for each release can be divided into the following situations: 1) Only the Native code is involved, and the iOS/Android team uses the latest trunk of the Flutter product. 2) Dart code is involved, and the iOS/Android team uses the Native code branch. At the same time, pull the Flutter branch, mark the iOS/Android branch address information, and synchronize the compilation output to the iOS/Android branch through the SVN scheduled task

conclusion

The above is our Now live terminal team’s thinking and practice process of iOS Flutter hybrid engineering transformation. Welcome to come and discuss. The Now live Terminal team is committed to making our own contribution to Flutter ecology. We look forward to better Flutter!