Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce add-to-app iOS setup image size, other cleanup #3345

Merged
merged 3 commits into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 45 additions & 53 deletions src/docs/development/add-to-app/ios/project-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,33 +81,35 @@ The following example assumes that your existing application and the Flutter mod
If you have a different directory organization, you may need to adjust the relative paths.

```text
some/path/
my_flutter/
.ios/Flutter/podhelper.rb
MyApp/
Podfile
some/path
├── my_flutter
│ └── .ios
│ └── Flutter
│ └── podhelper.rb
└── MyApp/
└── Podfile
```

If your existing application (`MyApp`) does not already have a Podfile, follow the
[CocoaPods getting started guide][] to add a `Podfile` to your project.

1. Add the following lines to your `Podfile`:

<?code-excerpt "MyApp/Podfile" title?>
```ruby
flutter_application_path = '../my_flutter'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
```
<?code-excerpt "MyApp/Podfile" title?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually fix the ordered list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding 4 characters does it, right @sfshaza2? https://stackoverflow.com/a/18089124/431116
See the <?code-excerpt "{codelabs/startup_namer/step1_base,layout/base}/lib/main.dart"?> line in
https://raw.githubusercontent.com/flutter/website/e6368d3e3bd0098b9727afff43501ddc6248d571/src/docs/development/ui/layout/tutorial.md

```ruby
flutter_application_path = '../my_flutter'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
```

2. For each [Podfile target][] that needs to
embed Flutter, call `install_all_flutter_pods(flutter_application_path)`.

<?code-excerpt "MyApp/Podfile" title?>
```ruby
target 'MyApp' do
install_all_flutter_pods(flutter_application_path)
end
```
<?code-excerpt "MyApp/Podfile" title?>
```ruby
target 'MyApp' do
install_all_flutter_pods(flutter_application_path)
end
```

3. Run `pod install`.

Expand All @@ -131,36 +133,36 @@ team cannot locally install Flutter SDK and CocoaPods, or if you do not wish to
as a dependency manager in your existing applications. You must run `flutter build ios-framework`
every time you make code changes in your Flutter module.

If you are using the above [Embed with CocoaPods and Flutter tools](#embed-with-CocoaPods-and-Flutter-tools)
If you are using the above [Embed with CocoaPods and Flutter tools](#embed-with-cocoapods-and-the-flutter-sdk)
method, you can skip these instructions.

The following example assumes you want to generate the frameworks to `some/path/MyApp/Flutter/`.

```text
some/path/
MyApp/
Flutter/
Debug/
Flutter.framework
App.framework
FlutterPluginRegistrant.framework
example_plugin.framework (each plugin with iOS platform code is a separate framework)
Profile/
Flutter.framework
App.framework
FlutterPluginRegistrant.framework
example_plugin.framework
Release/
Flutter.framework
App.framework
FlutterPluginRegistrant.framework
example_plugin.framework
```

```terminal
$ flutter build ios-framework --output=some/path/MyApp/Flutter/
```

```text
some/path
├── MyApp
└── Flutter
├── Debug
│ ├── Flutter.framework
│   ├── App.framework
│   ├── FlutterPluginRegistrant.framework
│   └── example_plugin.framework (each plugin with iOS platform code is a separate framework)
├── Profile
│ ├── Flutter.framework
│ ├── App.framework
│ ├── FlutterPluginRegistrant.framework
│ └── example_plugin.framework
└── Release
├── Flutter.framework
├── App.framework
├── FlutterPluginRegistrant.framework
└── example_plugin.framework
```

{{site.alert.tip}}
With Xcode 11 installed you can generate [XCFrameworks][] instead of universal frameworks by adding
the flags `--xcframework --no-universal`.
Expand All @@ -170,18 +172,8 @@ Embed the generated frameworks into your existing application in Xcode. For exam
drag the frameworks from `some/path/MyApp/Flutter/Release/` in Finder
into your targets's build settings > General > Frameworks, Libraries, and Embedded Content. Then, select
"Embed & Sign" from the drop-down.
<div class="container">
<div class="row">
<div class="col-sm text-center">
<figure class="figure">
{% asset development/add-to-app/ios/project-setup/embed-xcode.png %}
<figcaption class="figure-caption">
Embed frameworks in Xcode
</figcaption>
</figure>
</div>
</div>
</div>

{% include app-figure.md image="development/add-to-app/ios/project-setup/embed-xcode.png" alt="Embed frameworks in Xcode" %}

There are multiple ways to embed frameworks into a Xcode project—use the method that is best for your project.

Expand All @@ -199,10 +191,10 @@ You must also add `$(PROJECT_DIR)/Flutter/$(CONFIGURATION)` to your Framework Se
## Development
You can now [add a Flutter screen][] to your existing application.

[macOS system requirements for Flutter]: /docs/get-started/install/macos
[macOS system requirements for Flutter]: /docs/get-started/install/macos#system-requirements
[Xcode installed]: /docs/get-started/install/macos#install-xcode
[Android Studio/IntelliJ]: /docs/development/tools/android-studio#run-app-with-breakpoints
[VS Code]: /docs/development/tools/vs-code#run-app-with-breakpoints
[Android Studio/IntelliJ]: /docs/development/tools/android-studio
[VS Code]: /docs/development/tools/vs-code
[CocoaPods]: https://cocoapods.org/
[CocoaPods getting started guide]: https://guides.cocoapods.org/using/using-cocoapods.html
[Podfile target]: https://guides.cocoapods.org/syntax/podfile.html#target
Expand Down