From 9880ff0679811a9d6fb254955d08b7905e001d49 Mon Sep 17 00:00:00 2001 From: Andrew Brogdon Date: Mon, 9 Dec 2019 08:07:16 -0800 Subject: [PATCH] Adds new "prebuilt framework" add-to-app sample for iOS (#171) --- experimental/add_to_app/README.md | 68 ++-- .../add_to_app/flutter_module/pubspec.lock | 10 +- .../flutter_module_using_plugin/.gitignore | 1 + .../flutter_module_using_plugin/pubspec.lock | 10 +- .../IOSFullScreen.xcodeproj/project.pbxproj | 2 - .../IOSUsingPlugin.xcodeproj/project.pbxproj | 2 - .../ios_using_prebuilt_module/.gitignore | 19 + .../Flutter/README.md | 5 + .../project.pbxproj | 381 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../IOSUsingPrebuiltModule/AppDelegate.swift | 21 + .../AppIcon.appiconset/Contents.json | 98 +++++ .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 25 ++ .../Base.lproj/Main.storyboard | 52 +++ .../IOSUsingPrebuiltModule/Info.plist | 45 +++ .../ViewController.swift | 51 +++ 18 files changed, 768 insertions(+), 43 deletions(-) create mode 100644 experimental/add_to_app/ios_using_prebuilt_module/.gitignore create mode 100644 experimental/add_to_app/ios_using_prebuilt_module/Flutter/README.md create mode 100644 experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcodeproj/project.pbxproj create mode 100644 experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/AppDelegate.swift create mode 100644 experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Assets.xcassets/Contents.json create mode 100644 experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Base.lproj/LaunchScreen.storyboard create mode 100644 experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Base.lproj/Main.storyboard create mode 100644 experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Info.plist create mode 100644 experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/ViewController.swift diff --git a/experimental/add_to_app/README.md b/experimental/add_to_app/README.md index a57f5fa66..1fa74cd70 100644 --- a/experimental/add_to_app/README.md +++ b/experimental/add_to_app/README.md @@ -1,10 +1,7 @@ # Add-to-App Sample -***The Add-to-App sample is designed to build with Flutter's `master` channel. -See the [README](../README.md) in the `experimental` directory for details.*** - -This directory contains a bunch of Android and iOS projects that each import -a standalone Flutter module called `flutter_module`. +This directory contains a bunch of Android and iOS projects that each import a +standalone Flutter module. ## Goals for this sample @@ -16,8 +13,8 @@ a standalone Flutter module called `flutter_module`. ## Installing Cocoapods -The iOS samples in this repo require the latest version of Cocoapods. To install it, -run the following command on a MacOS machine: +The iOS samples in this repo require the latest version of Cocoapods. To install +it, run the following command on a MacOS machine: ```bash sudo gem install cocoapods @@ -33,7 +30,7 @@ There are two Flutter modules included in the codebase: * `flutter_module` displays the dimensions of the screen, a button that increments a simple counter, and an optional exit button. -* `flutter_module_using_plugin` does everything `flutter_module` does, and adds +* `flutter_module_using_plugin` does everything `flutter_module` does and adds another button that will open the Flutter documentation in a browser using the [`url_launcher`](https://pub.dev/packages/url_launcher) Flutter plugin. @@ -53,16 +50,10 @@ them. With the exception of `android_using_prebuilt_module`, the Android apps are ready to run once you've completed the `flutter packages get` commands listed -above. The iOS apps use CocoaPods, though, so you need to run this command to -install the dependencies listed in their Podfiles prior to running them the -first time. - -This should be done in the individual project directories themselves. For -example, prior to running `ios_fullscreen` or `ios_using_plugin` for the first -time, you need to run these commands: +above. The iOS apps use CocoaPods, though, so you need to run this command +within their project directories to install their dependencies: ```bash -cd ios_fullscreen pod install ``` @@ -100,30 +91,31 @@ following differences: If you're interested in learning what additional steps an app needs to take in order to use a Flutter module that relies on plugins, these projects can help. -### `android_using_prebuilt_module` +### `android_using_prebuilt_module` and `ios_using_prebuilt_module` -This app is essentially identical to `android_fullscreen` with one key -difference: +These apps are essentially identical to `android_fullscreen` and +`ios_fullscreen`, respectively, with one key difference. Rather than being set +up to compile the `flutter_module` from source each time the app is built, they +import a the module as a prebuilt `aar` (Android) or framework (iOS). This can +be useful for teams that don't want to require every developer working on the +app to have the Flutter toolchain installed on their local machines. -* The Flutter module is *not* built automatically when the app builds. Instead, - it's built separately into an `aar`. The Android app is configured to import - that `aar` along with its other gradle dependencies. +Prior to building either project for the first time, the `flutter_module` needs +to be built. -This can be useful for teams that don't want to require every developer working -on the app to have the Flutter toolchain installed on their local machines. +**Building for `android_using_prebuilt_module`** -Prior to building `android_using_prebuilt_module` for the first time, the -Flutter module should be built into an `aar`. The build can be done in a debug -or release configuration. To build a debug `aar`, run this command from the +`flutter_module` can be built into an `aar` using either a debug or release +configuration. To build a debug `aar`, run this command from the `flutter_module` directory: -``` +```bash flutter build aar --debug ``` To build a release version of the `aar`, simply omit the debug flag: -``` +```bash flutter build aar ``` @@ -134,6 +126,24 @@ for the debug `aar`, and likewise for a release build. If the `flutter_module` project is updated, the `aar` must be rebuilt via one of the commands above in order for those changes to appear in the app. +**Building for `ios_using_prebuilt_module`** + +`flutter_module` can be compiled into frameworks for `ios_using_prebuilt_module` +by running this command from the `flutter_module` directory: + +```bash +flutter build ios-framework --output=../ios_using_prebuilt_module/Flutter +``` + +This will output frameworks for debug, profile, and release modes into +`ios_using_prebuilt_module/Flutter`. The project file for +`ios_using_prebuilt_module` has been configured to find the frameworks there. + +For more information on how to modify an existing iOS app to reference prebuilt +Flutter frameworks, see this article in the Flutter GitHub wiki: + +https://flutter.dev/docs/development/add-to-app/ios/project-setup + ## Questions/issues If you have a general question about incorporating Flutter into an existing diff --git a/experimental/add_to_app/flutter_module/pubspec.lock b/experimental/add_to_app/flutter_module/pubspec.lock index 7a25da03a..6247e2bd1 100644 --- a/experimental/add_to_app/flutter_module/pubspec.lock +++ b/experimental/add_to_app/flutter_module/pubspec.lock @@ -7,7 +7,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.10" + version: "2.0.11" args: dependency: transitive description: @@ -21,7 +21,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.4.0" boolean_selector: dependency: transitive description: @@ -80,14 +80,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.6" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.7" + version: "1.1.8" path: dependency: transitive description: @@ -169,7 +169,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.2.11" typed_data: dependency: transitive description: diff --git a/experimental/add_to_app/flutter_module_using_plugin/.gitignore b/experimental/add_to_app/flutter_module_using_plugin/.gitignore index cdecf14aa..86f469179 100644 --- a/experimental/add_to_app/flutter_module_using_plugin/.gitignore +++ b/experimental/add_to_app/flutter_module_using_plugin/.gitignore @@ -39,3 +39,4 @@ build/ .android/ .ios/ .flutter-plugins +.flutter-plugins-dependencies diff --git a/experimental/add_to_app/flutter_module_using_plugin/pubspec.lock b/experimental/add_to_app/flutter_module_using_plugin/pubspec.lock index ee3d7195e..f55df6ea4 100644 --- a/experimental/add_to_app/flutter_module_using_plugin/pubspec.lock +++ b/experimental/add_to_app/flutter_module_using_plugin/pubspec.lock @@ -7,7 +7,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.10" + version: "2.0.11" args: dependency: transitive description: @@ -21,7 +21,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.4.0" boolean_selector: dependency: transitive description: @@ -80,14 +80,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.6" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.7" + version: "1.1.8" path: dependency: transitive description: @@ -169,7 +169,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.2.11" typed_data: dependency: transitive description: diff --git a/experimental/add_to_app/ios_fullscreen/IOSFullScreen.xcodeproj/project.pbxproj b/experimental/add_to_app/ios_fullscreen/IOSFullScreen.xcodeproj/project.pbxproj index 416393650..0a4a4922e 100644 --- a/experimental/add_to_app/ios_fullscreen/IOSFullScreen.xcodeproj/project.pbxproj +++ b/experimental/add_to_app/ios_fullscreen/IOSFullScreen.xcodeproj/project.pbxproj @@ -494,7 +494,6 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_BITCODE = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu11; @@ -556,7 +555,6 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_BITCODE = NO; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu11; diff --git a/experimental/add_to_app/ios_using_plugin/IOSUsingPlugin.xcodeproj/project.pbxproj b/experimental/add_to_app/ios_using_plugin/IOSUsingPlugin.xcodeproj/project.pbxproj index ce55385f9..ea49cedb7 100644 --- a/experimental/add_to_app/ios_using_plugin/IOSUsingPlugin.xcodeproj/project.pbxproj +++ b/experimental/add_to_app/ios_using_plugin/IOSUsingPlugin.xcodeproj/project.pbxproj @@ -494,7 +494,6 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_BITCODE = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu11; @@ -556,7 +555,6 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_BITCODE = NO; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu11; diff --git a/experimental/add_to_app/ios_using_prebuilt_module/.gitignore b/experimental/add_to_app/ios_using_prebuilt_module/.gitignore new file mode 100644 index 000000000..a99df1a68 --- /dev/null +++ b/experimental/add_to_app/ios_using_prebuilt_module/.gitignore @@ -0,0 +1,19 @@ +## User settings +xcuserdata/ + +## Obj-C/Swift specific +*.hmap + +## App packaging +*.ipa +*.dSYM.zip +*.dSYM + +.build/ + +Pods + +## Pre-built Flutter frameworks for flutter_module +Flutter/Debug/ +Flutter/Profile/ +Flutter/Release/ diff --git a/experimental/add_to_app/ios_using_prebuilt_module/Flutter/README.md b/experimental/add_to_app/ios_using_prebuilt_module/Flutter/README.md new file mode 100644 index 000000000..e66c9acf8 --- /dev/null +++ b/experimental/add_to_app/ios_using_prebuilt_module/Flutter/README.md @@ -0,0 +1,5 @@ +# Flutter frameworks folder + +This folder is intended to store pre-compiled Frameworks for a Flutter app, +which are not (in this case) checked into source control. See the README that +ships with this app for details on how to create the frameworks this app uses. diff --git a/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcodeproj/project.pbxproj b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcodeproj/project.pbxproj new file mode 100644 index 000000000..5693facc8 --- /dev/null +++ b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcodeproj/project.pbxproj @@ -0,0 +1,381 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 269CD2AF239B23BA0091DFB6 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 269CD2AD239B23BA0091DFB6 /* App.framework */; }; + 269CD2B0239B23BA0091DFB6 /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 269CD2AD239B23BA0091DFB6 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 269CD2B1239B23BA0091DFB6 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 269CD2AE239B23BA0091DFB6 /* Flutter.framework */; }; + 269CD2B2239B23BA0091DFB6 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 269CD2AE239B23BA0091DFB6 /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 26DC0F6C2398363A00D41B08 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26DC0F6B2398363A00D41B08 /* AppDelegate.swift */; }; + 26DC0F6E2398363A00D41B08 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26DC0F6D2398363A00D41B08 /* ViewController.swift */; }; + 26DC0F712398363A00D41B08 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 26DC0F6F2398363A00D41B08 /* Main.storyboard */; }; + 26DC0F732398363B00D41B08 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 26DC0F722398363B00D41B08 /* Assets.xcassets */; }; + 26DC0F762398363B00D41B08 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 26DC0F742398363B00D41B08 /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 269CD2B3239B23BA0091DFB6 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 269CD2B0239B23BA0091DFB6 /* App.framework in Embed Frameworks */, + 269CD2B2239B23BA0091DFB6 /* Flutter.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 269CD2AD239B23BA0091DFB6 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = "Flutter/$(CONFIGURATION)/App.framework"; sourceTree = ""; }; + 269CD2AE239B23BA0091DFB6 /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = "Flutter/$(CONFIGURATION)/Flutter.framework"; sourceTree = ""; }; + 26DC0F682398363A00D41B08 /* IOSUsingPrebuiltModule.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IOSUsingPrebuiltModule.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 26DC0F6B2398363A00D41B08 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 26DC0F6D2398363A00D41B08 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 26DC0F702398363A00D41B08 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 26DC0F722398363B00D41B08 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 26DC0F752398363B00D41B08 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 26DC0F772398363B00D41B08 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 26DC0F652398363A00D41B08 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 269CD2AF239B23BA0091DFB6 /* App.framework in Frameworks */, + 269CD2B1239B23BA0091DFB6 /* Flutter.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 269CD2AC239B23BA0091DFB6 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 269CD2AD239B23BA0091DFB6 /* App.framework */, + 269CD2AE239B23BA0091DFB6 /* Flutter.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 26DC0F5F2398363A00D41B08 = { + isa = PBXGroup; + children = ( + 26DC0F6A2398363A00D41B08 /* IOSUsingPrebuiltModule */, + 26DC0F692398363A00D41B08 /* Products */, + 269CD2AC239B23BA0091DFB6 /* Frameworks */, + ); + sourceTree = ""; + }; + 26DC0F692398363A00D41B08 /* Products */ = { + isa = PBXGroup; + children = ( + 26DC0F682398363A00D41B08 /* IOSUsingPrebuiltModule.app */, + ); + name = Products; + sourceTree = ""; + }; + 26DC0F6A2398363A00D41B08 /* IOSUsingPrebuiltModule */ = { + isa = PBXGroup; + children = ( + 26DC0F6B2398363A00D41B08 /* AppDelegate.swift */, + 26DC0F6D2398363A00D41B08 /* ViewController.swift */, + 26DC0F6F2398363A00D41B08 /* Main.storyboard */, + 26DC0F722398363B00D41B08 /* Assets.xcassets */, + 26DC0F742398363B00D41B08 /* LaunchScreen.storyboard */, + 26DC0F772398363B00D41B08 /* Info.plist */, + ); + path = IOSUsingPrebuiltModule; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 26DC0F672398363A00D41B08 /* IOSUsingPrebuiltModule */ = { + isa = PBXNativeTarget; + buildConfigurationList = 26DC0F902398363C00D41B08 /* Build configuration list for PBXNativeTarget "IOSUsingPrebuiltModule" */; + buildPhases = ( + 26DC0F642398363A00D41B08 /* Sources */, + 26DC0F652398363A00D41B08 /* Frameworks */, + 26DC0F662398363A00D41B08 /* Resources */, + 269CD2B3239B23BA0091DFB6 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = IOSUsingPrebuiltModule; + productName = IOSUsingPrebuiltModule; + productReference = 26DC0F682398363A00D41B08 /* IOSUsingPrebuiltModule.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 26DC0F602398363A00D41B08 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1030; + LastUpgradeCheck = 1030; + ORGANIZATIONNAME = "Andrew Brogdon"; + TargetAttributes = { + 26DC0F672398363A00D41B08 = { + CreatedOnToolsVersion = 10.3; + }; + }; + }; + buildConfigurationList = 26DC0F632398363A00D41B08 /* Build configuration list for PBXProject "IOSUsingPrebuiltModule" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 26DC0F5F2398363A00D41B08; + productRefGroup = 26DC0F692398363A00D41B08 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 26DC0F672398363A00D41B08 /* IOSUsingPrebuiltModule */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 26DC0F662398363A00D41B08 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 26DC0F762398363B00D41B08 /* LaunchScreen.storyboard in Resources */, + 26DC0F732398363B00D41B08 /* Assets.xcassets in Resources */, + 26DC0F712398363A00D41B08 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 26DC0F642398363A00D41B08 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 26DC0F6E2398363A00D41B08 /* ViewController.swift in Sources */, + 26DC0F6C2398363A00D41B08 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 26DC0F6F2398363A00D41B08 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 26DC0F702398363A00D41B08 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 26DC0F742398363B00D41B08 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 26DC0F752398363B00D41B08 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 26DC0F8E2398363C00D41B08 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 26DC0F8F2398363C00D41B08 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 26DC0F912398363C00D41B08 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter/$(CONFIGURATION)", + ); + INFOPLIST_FILE = IOSUsingPrebuiltModule/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.example.IOSUsingPrebuiltModule; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 26DC0F922398363C00D41B08 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter/$(CONFIGURATION)", + ); + INFOPLIST_FILE = IOSUsingPrebuiltModule/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.example.IOSUsingPrebuiltModule; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 26DC0F632398363A00D41B08 /* Build configuration list for PBXProject "IOSUsingPrebuiltModule" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 26DC0F8E2398363C00D41B08 /* Debug */, + 26DC0F8F2398363C00D41B08 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 26DC0F902398363C00D41B08 /* Build configuration list for PBXNativeTarget "IOSUsingPrebuiltModule" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 26DC0F912398363C00D41B08 /* Debug */, + 26DC0F922398363C00D41B08 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 26DC0F602398363A00D41B08 /* Project object */; +} diff --git a/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..dedfde3a0 --- /dev/null +++ b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/AppDelegate.swift b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/AppDelegate.swift new file mode 100644 index 000000000..a4ef063b3 --- /dev/null +++ b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/AppDelegate.swift @@ -0,0 +1,21 @@ +// Copyright 2019 The Flutter team. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import UIKit +import Flutter + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + var window: UIWindow? + + var flutterEngine : FlutterEngine? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Instantiate Flutter engine + self.flutterEngine = FlutterEngine(name: "io.flutter", project: nil) + self.flutterEngine?.run(withEntrypoint: nil) + + return true + } +} diff --git a/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Assets.xcassets/AppIcon.appiconset/Contents.json b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..d8db8d65f --- /dev/null +++ b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Assets.xcassets/Contents.json b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Assets.xcassets/Contents.json new file mode 100644 index 000000000..da4a164c9 --- /dev/null +++ b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Base.lproj/LaunchScreen.storyboard b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..bfa361294 --- /dev/null +++ b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Base.lproj/Main.storyboard b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Base.lproj/Main.storyboard new file mode 100644 index 000000000..ec94c8863 --- /dev/null +++ b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Base.lproj/Main.storyboard @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Info.plist b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Info.plist new file mode 100644 index 000000000..16be3b681 --- /dev/null +++ b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/ViewController.swift b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/ViewController.swift new file mode 100644 index 000000000..615c49def --- /dev/null +++ b/experimental/add_to_app/ios_using_prebuilt_module/IOSUsingPrebuiltModule/ViewController.swift @@ -0,0 +1,51 @@ +// Copyright 2019 The Flutter team. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import UIKit +import Flutter + +class ViewController: UIViewController { + + @IBOutlet weak var counterLabel: UILabel! + + var methodChannel : FlutterMethodChannel? + var count = 0 + + override func viewDidLoad() { + super.viewDidLoad() + + if let flutterEngine = (UIApplication.shared.delegate as? AppDelegate)?.flutterEngine { + methodChannel = FlutterMethodChannel(name: "dev.flutter.example/counter", + binaryMessenger: flutterEngine.binaryMessenger) + methodChannel?.setMethodCallHandler({ [weak self] + (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in + if let strongSelf = self { + switch(call.method) { + case "incrementCounter": + strongSelf.count += 1 + strongSelf.counterLabel.text = "Current counter: \(strongSelf.count)" + strongSelf.reportCounter() + case "requestCounter": + strongSelf.reportCounter() + default: + // Unrecognized method name + print("Unrecognized method name: \(call.method)") + } + } + }) + } + } + + func reportCounter() { + methodChannel?.invokeMethod("reportCounter", arguments: count) + } + + @IBAction func buttonWasTapped(_ sender: Any) { + if let flutterEngine = (UIApplication.shared.delegate as? AppDelegate)?.flutterEngine { + let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil) + self.present(flutterViewController, animated: false, completion: nil) + } + } +} +