Skip to content
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
6 changes: 3 additions & 3 deletions src/content/docs/code-push/guides/add-to-app/android.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ If your app is a pure Flutter app, follow the

## Prerequisites

This guide assumes you have already have an Android app and a Flutter module.
The Android app will be named `android_app` and the Flutter module will be named
`flutter_module`.
This guide assumes you already have an Android app and a Flutter module. The
Android app will be named `AddToAppDemo` (in the sample's `AndroidAddToAppDemo`
directory) and the Flutter module will be named `my_flutter_module`.

This guide also assumes that you have created a Shorebird account. If you have
not, see the [Code Push guide](/code-push/initialize) for instructions.
Expand Down
34 changes: 18 additions & 16 deletions src/content/docs/code-push/guides/add-to-app/ios.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ If your app is a pure Flutter app, follow the

## Prerequisites

This guide assumes you have already have an iOS app and a Flutter module. The
example iOS app will be named `IosCodePushDemo` and the example Flutter module
will be named `flutter_module`.
This guide assumes you already have an iOS app and a Flutter module. The example
iOS app will be named `IosAddToAppDemo` and the example Flutter module will be
named `my_flutter_module`.

This guide also assumes that you have created a Shorebird account. If you have
not created a Shorebird account, please see the
Expand All @@ -41,10 +41,12 @@ https://github.com/shorebirdtech/samples/tree/main/add_to_app.
:::note

Shorebird only supports the iOS Framework embedding method of adding Flutter to
a native iOS app (see "Use iOS frameworks" in the
[official integration docs](https://docs.flutter.dev/add-to-app/ios/project-setup)).
There is an open issue to support embedding via CocoaPods
([link](https://github.com/shorebirdtech/shorebird/issues/1198)), but given that
a native iOS app (see "Link and Embed frameworks in Xcode" in Flutter's
[legacy integration docs](https://docs.flutter.dev/add-to-app/ios/project-setup-legacy#method-b)).
It doesn't support the Swift Package Manager integration that Flutter has
recommended since Flutter 3.44. There is an open issue to support embedding via
CocoaPods ([link](https://github.com/shorebirdtech/shorebird/issues/1198)), but
given that
[Flutter plans to deprecate CocoaPods support](https://github.com/flutter/flutter/issues/168015),
it is unlikely that this will be implemented.

Expand All @@ -64,7 +66,7 @@ First, package the Flutter module for release. This will produce an
`.xcframework` that can be embedded in your iOS app and provides Shorebird with
the information it needs to apply patches.

To create a release, run the following the root directory of your Flutter
To create a release, run the following in the root directory of your Flutter
module:

```sh
Expand Down Expand Up @@ -99,17 +101,17 @@ requires that your Flutter module be embedded in your iOS app as an

:::note

The steps to do this are the same as the
[option B in the official instructions](https://docs.flutter.dev/add-to-app/ios/project-setup#option-b---embed-frameworks-in-xcode),
so in the event of a conflict between the docs here and the official docs, defer
to the official docs.
The steps to do this are the same as Flutter's
[Link and Embed frameworks in Xcode](https://docs.flutter.dev/add-to-app/ios/project-setup-legacy#method-b)
instructions, so in the event of a conflict between the docs here and the
official docs, defer to the official docs.

:::

:::note

`ShorebirdFlutter.xcframework` is nearly identically to `Flutter.xcframework`
from Google, but as part of compliance with Apple's signing requirements, the
`ShorebirdFlutter.xcframework` is nearly identical to `Flutter.xcframework` from
Google, but as part of compliance with Apple's signing requirements, the
framework has been renamed when applying Shorebird's (legally Code Town, Inc's)
digital signature.

Expand All @@ -130,10 +132,10 @@ In Xcode:

<Image src={hybridIosFrameworkSearchPaths} alt="Xcode framework search paths" />

### Embed App.xcframework and Flutter.xcframework in your app
### Embed App.xcframework and ShorebirdFlutter.xcframework in your app

In the "General" tab of your app target, add `App.xcframework` and
`ShorebirdFlutter.xcframework` from to the "Frameworks, Libraries, and Embedded
`ShorebirdFlutter.xcframework` to the "Frameworks, Libraries, and Embedded
Content" section. Make sure to select "Embed & Sign" for both frameworks.

<Image src={hybridIosEmbedFrameworks} alt="Xcode embed frameworks" />
Expand Down
40 changes: 29 additions & 11 deletions src/content/docs/flutter-concepts/add-to-app.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -306,28 +306,46 @@ different view. An engine can only render into one view at a time.

### 1. Add the module as a dependency

Since Flutter 3.44, the recommended method is **Swift Package Manager (SPM)**.
Run the following command in the Flutter module directory to generate an
XCFramework:

```bash
flutter build ios-framework --xcframework --output=../MyFlutterPackage
```

Then add the local package in Xcode: **File > Add Package Dependencies > Add
Local**, and point to the generated `MyFlutterPackage` directory.
Since Flutter 3.44, Flutter has recommended adding a module to an iOS app as a
Swift package with **Swift Package Manager (SPM)**. Its legacy docs also cover
CocoaPods and prebuilt XCFrameworks linked and embedded in Xcode.

:::caution

Shorebird releases and patches only the XCFrameworks that
`shorebird release ios-framework` builds (`App.xcframework` and
`ShorebirdFlutter.xcframework`), embedded directly in your Xcode project. It
does not release or patch the Swift package setup above. See the
does not release or patch a Swift package integration. See the
[Code Push for iOS add-to-app](/code-push/guides/add-to-app/ios/) guide for the
setup Shorebird supports.

:::

#### Swift package

Run the following command in the Flutter module directory:

```bash
flutter build swift-package --platform ios
```

It generates a `FlutterNativeIntegration` Swift package in
`build/ios/SwiftPackages/`. To add it to your app, follow Flutter's
[Integrate with Swift Package Manager](https://docs.flutter.dev/add-to-app/ios/project-setup#integrate-with-swiftpm)
instructions: add the package to your Xcode project with **Add Files to
"MyApp"...**, add it to your app target, then add the build settings and Run
Script steps.

#### Prebuilt XCFrameworks (release and patch)

Build the module into XCFrameworks (`flutter build ios-framework`, or
`shorebird release ios-framework` with Shorebird), then link and embed them in
your app target. See Flutter's
[Link and Embed frameworks in Xcode](https://docs.flutter.dev/add-to-app/ios/project-setup-legacy#method-b)
instructions, or the
[Code Push for iOS add-to-app](/code-push/guides/add-to-app/ios/) guide for the
Shorebird setup.

### 2. Display Flutter content

#### Full-screen: FlutterViewController
Expand Down
Loading