Skip to content

Instantly share code, notes, and snippets.

@collinjackson
Last active October 16, 2015 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save collinjackson/d103fc081802ba029854 to your computer and use it in GitHub Desktop.
Save collinjackson/d103fc081802ba029854 to your computer and use it in GitHub Desktop.
Instructions for building Flutter for iOS

Instructions for building Flutter for iOS

Important notes:

  • These instructions are for building from source. Developer workflow for iOS will get a lot simpler once we publish the precompiled iOS binaries in the public Flutter SDK.

  • Dart precompilation for iOS is landing soon. This will make the builds much faster.

Getting the code

  • Download depot_tools and make sure it is in your path.

  • Create an empty directory for your copy of the repository. Call it what you like. For the sake of the instructions that follow, we'll call it flutter.

  • Create a .gclient in the flutter directory with the following contents:

      solutions = [
        {
          "managed": False,
          "name": "src",
          "url": "git@github.com:flutter/engine.git",
          "custom_deps": {},
          "deps_file": "DEPS",
          "safesync_url": "",
        },
      ]
      target_os = ["android"]
    
  • Download the Flutter source

          cd flutter
          gclient sync
    
  • Check out a version of Flutter that’s known to run on iOS:

          git checkout origin/known_good_ios
          gclient sync
    

Building the code

  • Build for iOS (to use a real device omit --simulator and _sim)

          cd src
          ./sky/tools/gn --ios --simulator
          ninja -C out/ios_sim_Debug/ -j 200
    

Running the code

  • Open the harness xcode project for the app you want to preview.

    • To run the game project in examples/game:

        open out/ios_sim_Debug/game_app_xcode/Harness.xcodeproj/
      
    • To run the Stocks project in examples/stocks:

        open out/ios_sim_Debug/stocks_app_xcode/Harness.xcodeproj/
      
  • Select the simulator or device that you want to test on and press play. If you don’t see the simulator you want, click on the Project and change the deployment target to match an OS version that you have the simulator for.

  • You can make changes to the app (Stocks app's source code is in flutter/examples/stocks) using Atom (install the dartlang and linter packages) or another text editor of your choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment