|
| 1 | +## Configure iOS development |
| 2 | + |
| 3 | +{% assign prompt1='$' %} |
| 4 | +{% assign os = include.os %} |
| 5 | +{% assign target = include.target %} |
| 6 | + |
| 7 | +### Configure Xcode |
| 8 | + |
| 9 | +To develop Flutter apps for {{os}}, install Xcode to compile to native bytecode. |
| 10 | + |
| 11 | +1. To configure the Xcode command-line tools to use the installed version, |
| 12 | + run the following commands. |
| 13 | + |
| 14 | + ```terminal |
| 15 | + {{prompt1}} sudo sh -c 'xcode-select -s /Applications/Xcode.app/Contents/Developer && xcodebuild -runFirstLaunch' |
| 16 | + ``` |
| 17 | +
|
| 18 | + To use the latest version of Xcode, use this path. |
| 19 | + If you need to use a different version, specify that path instead. |
| 20 | +
|
| 21 | +{% if target=="mobile-ios" %} |
| 22 | +
|
| 23 | +1. To install the iOS Simulator, run the following command. |
| 24 | +
|
| 25 | + ```terminal |
| 26 | + {{prompt1}} xcodebuild -downloadPlatform iOS |
| 27 | + ``` |
| 28 | +
|
| 29 | +{% endif %} |
| 30 | +
|
| 31 | +1. Sign the Xcode license agreement. |
| 32 | +
|
| 33 | + ```terminal |
| 34 | + {{prompt1}} sudo xcodebuild -license |
| 35 | + ``` |
| 36 | +
|
| 37 | +Try to keep to the current version of Xcode. |
| 38 | +
|
| 39 | +{% if target=="mobile-ios" %} |
| 40 | +
|
| 41 | +### Configure your target iOS device |
| 42 | +
|
| 43 | +With Xcode, you can run Flutter apps on an iOS device or on the simulator. |
| 44 | +
|
| 45 | +{% comment %} Nav tabs {% endcomment -%} |
| 46 | +<ul class="nav nav-tabs" id="ios-devices-vp" role="tablist"> |
| 47 | + <li class="nav-item"> |
| 48 | + <a class="nav-link active" id="virtual-tab" href="#virtual" role="tab" aria-controls="virtual" aria-selected="true">Virtual Device</a> |
| 49 | + </li> |
| 50 | + <li class="nav-item"> |
| 51 | + <a class="nav-link" id="physical-tab" href="#physical" role="tab" aria-controls="physical" aria-selected="false">Physical Device</a> |
| 52 | + </li> |
| 53 | +</ul> |
| 54 | +
|
| 55 | +{% comment %} Tab panes {% endcomment -%} |
| 56 | +<div class="tab-content"> |
| 57 | +
|
| 58 | +<div class="tab-pane active" id="virtual" role="tabpanel" aria-labelledby="virtual-tab" markdown="1"> |
| 59 | +
|
| 60 | +{% include docs/install/devices/ios-simulator.md os=include.os %} |
| 61 | +
|
| 62 | +</div> |
| 63 | +
|
| 64 | +<div class="tab-pane" id="physical" role="tabpanel" aria-labelledby="physical-tab" markdown="1"> |
| 65 | +
|
| 66 | +{% include docs/install/devices/ios-physical.md os=include.os %} |
| 67 | +
|
| 68 | +</div> |
| 69 | +</div> |
| 70 | +{% comment %} End: Tab panes. {% endcomment -%} |
| 71 | +
|
| 72 | +{% endif %} |
| 73 | +
|
| 74 | +### Install CocoaPods |
| 75 | +
|
| 76 | +If your apps depend on [Flutter plugins][] with native {{os}} code, |
| 77 | +install CocoaPods. Built using Ruby, |
| 78 | +CocoaPods handles the bundling of various dependencies across Flutter |
| 79 | +and {{os}} code. |
| 80 | +
|
| 81 | +To [install and set up CocoaPods][cocoapods], run the following commands: |
| 82 | +
|
| 83 | +1. Install Homebrew if necessary. |
| 84 | +
|
| 85 | + ```terminal |
| 86 | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
| 87 | + ``` |
| 88 | + |
| 89 | +1. Install `ruby` using Homebrew. |
| 90 | + |
| 91 | + ```terminal |
| 92 | + {{prompt1}} brew install ruby |
| 93 | + ``` |
| 94 | + |
| 95 | +1. Install `cocoapods` using Homebrew. |
| 96 | + |
| 97 | + ```terminal |
| 98 | + {{prompt1}} brew install cocoapods |
| 99 | + ``` |
| 100 | + |
| 101 | +Using Homebrew reduces potential issues with chipsets and install permissions. |
| 102 | + |
| 103 | +[Flutter plugins]: {{site.url}}/packages-and-plugins/developing-packages#types |
| 104 | +[cocoapods]: https://formulae.brew.sh/formula/cocoapods |
0 commit comments