diff --git a/MAINTENANCE.md b/MAINTENANCE.md index 0593cb6ef..7df6b8d99 100644 --- a/MAINTENANCE.md +++ b/MAINTENANCE.md @@ -15,7 +15,7 @@ match any new language/SDK features, etc.). | material_studies/shrine | | | | place_tracker | | | | platform_design | johnpryan | 10/7/19 | -| platform_view_swift | | | +| platform_view_swift | redbrogdon | 10/7/19 | | provider_counter | | | | provider_shopper | | | | veggieseasons | | | diff --git a/platform_view_swift/.gitignore b/platform_view_swift/.gitignore index 07488ba61..2ddde2a5e 100644 --- a/platform_view_swift/.gitignore +++ b/platform_view_swift/.gitignore @@ -15,8 +15,10 @@ *.iws .idea/ -# Visual Studio Code related -.vscode/ +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ # Flutter/Dart/Pub related **/doc/api/ @@ -59,6 +61,7 @@ **/ios/Flutter/app.flx **/ios/Flutter/app.zip **/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh **/ios/ServiceDefinitions.json **/ios/Runner/GeneratedPluginRegistrant.* diff --git a/platform_view_swift/.metadata b/platform_view_swift/.metadata new file mode 100644 index 000000000..aeb01ee24 --- /dev/null +++ b/platform_view_swift/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 2d2a1ffec95cc70a3218872a2cd3f8de4933c42f + channel: stable + +project_type: app diff --git a/platform_view_swift/README.md b/platform_view_swift/README.md index 44b2c0129..14d56e4ea 100644 --- a/platform_view_swift/README.md +++ b/platform_view_swift/README.md @@ -1,10 +1,33 @@ -# Example of switching between full-screen Flutter and Platform View +# platform_view_swift -This project demonstrates how to bring up a full-screen iOS view from a full-screen -Flutter view along with passing data back and forth between the two. +A Flutter sample app that combines a native iOS UIViewController +with a full-screen Flutter view. -On iOS we use a CocoaPods dependency to add a Material Design button, and so -`pod install` needs to be invoked in the `ios/` folder before `flutter run`: +## Goals for this sample + +* Show a simple technique for combining native and Flutter views. + +## The important bits + +### `lib/main.dart` + +The Flutter part of the application is quite simple, and all the action +takes place in a single file. + +### `ios/Runner/PlatformViewController.swift` and `AppDelegate.swift` + +These files contain the Swift code repsonsible for setting up a platform +channel, launching a native UIViewController, and returning control to +Flutter when finished. + +## Questions/issues + +If you have a general question about Flutter, the best places to go are: + +* [The FlutterDev Google Group](https://groups.google.com/forum/#!forum/flutter-dev) +* [The Flutter Gitter channel](https://gitter.im/flutter/flutter) +* [StackOverflow](https://stackoverflow.com/questions/tagged/flutter) + +If you run into an issue with the sample itself, please file an issue +in the [main Flutter repo](https://github.com/flutter/flutter/issues). -pushd ios/ ; pod install ; popd -flutter run diff --git a/platform_view_swift/assets/flutter-mark-square-64.png b/platform_view_swift/assets/flutter-mark-square-64.png deleted file mode 100644 index 56f22d5bd..000000000 Binary files a/platform_view_swift/assets/flutter-mark-square-64.png and /dev/null differ diff --git a/platform_view_swift/ios/.gitignore b/platform_view_swift/ios/.gitignore deleted file mode 100644 index 2a8c8b606..000000000 --- a/platform_view_swift/ios/.gitignore +++ /dev/null @@ -1,44 +0,0 @@ -.idea/ -.vagrant/ -.sconsign.dblite -.svn/ - -.DS_Store -*.swp -profile - -DerivedData/ -build/ -GeneratedPluginRegistrant.h -GeneratedPluginRegistrant.m - -.generated/ - -*.pbxuser -*.mode1v3 -*.mode2v3 -*.perspectivev3 - -!default.pbxuser -!default.mode1v3 -!default.mode2v3 -!default.perspectivev3 - -xcuserdata - -*.moved-aside - -*.pyc -*sync/ -Icon? -.tags* - -/Flutter/app.flx -/Flutter/app.zip -/Flutter/flutter_assets/ -/Flutter/App.framework -/Flutter/Flutter.framework -/Flutter/Generated.xcconfig -/ServiceDefinitions.json - -Pods/ diff --git a/platform_view_swift/ios/Flutter/AppFrameworkInfo.plist b/platform_view_swift/ios/Flutter/AppFrameworkInfo.plist index 9367d483e..6b4c0f78a 100644 --- a/platform_view_swift/ios/Flutter/AppFrameworkInfo.plist +++ b/platform_view_swift/ios/Flutter/AppFrameworkInfo.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + $(DEVELOPMENT_LANGUAGE) CFBundleExecutable App CFBundleIdentifier diff --git a/platform_view_swift/ios/Flutter/Debug.xcconfig b/platform_view_swift/ios/Flutter/Debug.xcconfig index c16872744..592ceee85 100644 --- a/platform_view_swift/ios/Flutter/Debug.xcconfig +++ b/platform_view_swift/ios/Flutter/Debug.xcconfig @@ -1,2 +1 @@ #include "Generated.xcconfig" -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" \ No newline at end of file diff --git a/platform_view_swift/ios/Flutter/Release.xcconfig b/platform_view_swift/ios/Flutter/Release.xcconfig index 2bd06e776..592ceee85 100644 --- a/platform_view_swift/ios/Flutter/Release.xcconfig +++ b/platform_view_swift/ios/Flutter/Release.xcconfig @@ -1,2 +1 @@ #include "Generated.xcconfig" -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" \ No newline at end of file diff --git a/platform_view_swift/ios/Podfile b/platform_view_swift/ios/Podfile deleted file mode 100644 index dcc6b981d..000000000 --- a/platform_view_swift/ios/Podfile +++ /dev/null @@ -1,65 +0,0 @@ -# Uncomment this line to define a global platform for your project -# platform :ios, '9.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; - end - pods_ary = [] - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) { |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - pods_ary.push({:name => podname, :path => podpath}); - else - puts "Invalid plugin specification: #{line}" - end - } - return pods_ary -end - -target 'Runner' do - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') - - # Flutter Pods - generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') - if generated_xcode_build_settings.empty? - puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first." - end - generated_xcode_build_settings.map { |p| - if p[:name] == 'FLUTTER_FRAMEWORK_DIR' - symlink = File.join('.symlinks', 'flutter') - File.symlink(File.dirname(p[:path]), symlink) - pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) - end - } - - # Plugin Pods - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.map { |p| - symlink = File.join('.symlinks', 'plugins', p[:name]) - File.symlink(p[:path], symlink) - pod p[:name], :path => File.join(symlink, 'ios') - } - - pod 'MaterialControls' -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end - end -end diff --git a/platform_view_swift/ios/Runner.xcodeproj/project.pbxproj b/platform_view_swift/ios/Runner.xcodeproj/project.pbxproj index 3f94bad1a..f509ccfcc 100644 --- a/platform_view_swift/ios/Runner.xcodeproj/project.pbxproj +++ b/platform_view_swift/ios/Runner.xcodeproj/project.pbxproj @@ -8,20 +8,18 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 2788264B20CF7D710075B10E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2788264A20CF7D710075B10E /* AppDelegate.swift */; }; - 2788264D20CF7D790075B10E /* PlatformViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2788264C20CF7D790075B10E /* PlatformViewController.swift */; }; - 2DAF064E1ED4224F00716BEE /* ic_add.png in Resources */ = {isa = PBXBuildFile; fileRef = 2DAF064D1ED4224F00716BEE /* ic_add.png */; }; + 26CDDD6B234BE139004C7A30 /* PlatformViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26CDDD69234BE139004C7A30 /* PlatformViewController.swift */; }; + 26CDDD6C234BE139004C7A30 /* PlatformViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 26CDDD6A234BE139004C7A30 /* PlatformViewController.xib */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; - 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - ECB86F1A0B90276D0AEF4169 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E6555FD3971FC12A9802782 /* libPods-Runner.a */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -42,13 +40,12 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 2788264920CF7D700075B10E /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; - 2788264A20CF7D710075B10E /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 2788264C20CF7D790075B10E /* PlatformViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlatformViewController.swift; sourceTree = ""; }; - 2DAF064D1ED4224F00716BEE /* ic_add.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ic_add.png; sourceTree = ""; }; + 26CDDD69234BE139004C7A30 /* PlatformViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlatformViewController.swift; sourceTree = ""; }; + 26CDDD6A234BE139004C7A30 /* PlatformViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PlatformViewController.xib; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; - 6E6555FD3971FC12A9802782 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; @@ -67,20 +64,12 @@ files = ( 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, - ECB86F1A0B90276D0AEF4169 /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 5A56E2F315C4CB64895375DA /* Pods */ = { - isa = PBXGroup; - children = ( - ); - name = Pods; - sourceTree = ""; - }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -100,8 +89,6 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - 5A56E2F315C4CB64895375DA /* Pods */, - E9007A48891C669D010E4F3D /* Frameworks */, ); sourceTree = ""; }; @@ -116,26 +103,26 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( - 2788264C20CF7D790075B10E /* PlatformViewController.swift */, - 2788264A20CF7D710075B10E /* AppDelegate.swift */, - 2DAF064D1ED4224F00716BEE /* ic_add.png */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, + 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, - 2788264920CF7D700075B10E /* Runner-Bridging-Header.h */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + 26CDDD69234BE139004C7A30 /* PlatformViewController.swift */, + 26CDDD6A234BE139004C7A30 /* PlatformViewController.xib */, ); path = Runner; sourceTree = ""; }; - E9007A48891C669D010E4F3D /* Frameworks */ = { + 97C146F11CF9000F007C117D /* Supporting Files */ = { isa = PBXGroup; children = ( - 6E6555FD3971FC12A9802782 /* libPods-Runner.a */, ); - name = Frameworks; + name = "Supporting Files"; sourceTree = ""; }; /* End PBXGroup section */ @@ -145,14 +132,12 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - BE1F6A680926BCE299C7F0C1 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 23ADFA8256C517EB939E4349 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -169,19 +154,18 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0830; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "The Chromium Authors"; TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = 7H6KECYDM2; - LastSwiftMigration = 0940; + LastSwiftMigration = 0910; }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -202,37 +186,18 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 2DAF064E1ED4224F00716BEE /* ic_add.png in Resources */, 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, - 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + 26CDDD6C234BE139004C7A30 /* PlatformViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 23ADFA8256C517EB939E4349 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -261,24 +226,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - BE1F6A680926BCE299C7F0C1 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -286,9 +233,9 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 2788264B20CF7D710075B10E /* AppDelegate.swift in Sources */, + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 26CDDD6B234BE139004C7A30 /* PlatformViewController.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, - 2788264D20CF7D790075B10E /* PlatformViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -314,6 +261,83 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = 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_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_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "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 = gnu99; + 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 = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.samples.platformViewSwift; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 4.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; @@ -324,14 +348,22 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_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_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -372,14 +404,22 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_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_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -399,6 +439,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -410,24 +451,25 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = 7H6KECYDM2; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.FullPlatformViewSwift; + PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.samples.platformViewSwift; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; + VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; }; @@ -437,23 +479,24 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = 7H6KECYDM2; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.FullPlatformViewSwift; + PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.samples.platformViewSwift; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; + VERSIONING_SYSTEM = "apple-generic"; }; name = Release; }; @@ -465,6 +508,7 @@ buildConfigurations = ( 97C147031CF9000F007C117D /* Debug */, 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -474,6 +518,7 @@ buildConfigurations = ( 97C147061CF9000F007C117D /* Debug */, 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/platform_view_swift/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/platform_view_swift/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 1c9580788..a28140cfd 100644 --- a/platform_view_swift/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/platform_view_swift/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ - - diff --git a/platform_view_swift/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/platform_view_swift/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/platform_view_swift/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/platform_view_swift/ios/Runner/AppDelegate.swift b/platform_view_swift/ios/Runner/AppDelegate.swift index 705e86dbd..e4cf4b61b 100644 --- a/platform_view_swift/ios/Runner/AppDelegate.swift +++ b/platform_view_swift/ios/Runner/AppDelegate.swift @@ -8,36 +8,36 @@ import Flutter @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate, PlatformViewControllerDelegate { - var flutterResult: FlutterResult? - - override func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - GeneratedPluginRegistrant.register(with: self) - let controller: FlutterViewController = window?.rootViewController as! FlutterViewController - let channel = FlutterMethodChannel.init(name: "samples.flutter.io/platform_view_swift", binaryMessenger: controller) - - channel.setMethodCallHandler({ - (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in - if ("switchView" == call.method) { - self.flutterResult = result - - let platformViewController = controller.storyboard?.instantiateViewController(withIdentifier: "PlatformView") as! PlatformViewController - platformViewController.counter = call.arguments as! Int - platformViewController.delegate = self - - let navigationController = UINavigationController(rootViewController: platformViewController) - navigationController.navigationBar.topItem?.title = "Platform View" - controller.present(navigationController, animated: true, completion: nil) - } else { - result(FlutterMethodNotImplemented) - } - }); - - return super.application(application, didFinishLaunchingWithOptions: launchOptions) - } - - func didUpdateCounter(counter: Int) { - flutterResult?(counter) - } + var flutterResult: FlutterResult? + + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + GeneratedPluginRegistrant.register(with: self) + let controller: FlutterViewController = window?.rootViewController as! FlutterViewController + let channel = FlutterMethodChannel.init(name: "dev.flutter.sample/platform_view_swift", binaryMessenger: controller.binaryMessenger) + + channel.setMethodCallHandler({ + (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in + if ("switchView" == call.method) { + self.flutterResult = result + + let platformViewController = PlatformViewController(nibName: "PlatformViewController", bundle: nil) + platformViewController.counter = call.arguments as! Int + platformViewController.delegate = self + + let navigationController = UINavigationController(rootViewController: platformViewController) + navigationController.navigationBar.topItem?.title = "Platform View" + controller.present(navigationController, animated: true, completion: nil) + } else { + result(FlutterMethodNotImplemented) + } + }); + + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } + + func didUpdateCounter(counter: Int) { + flutterResult?(counter) + } } diff --git a/platform_view_swift/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/platform_view_swift/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index d22f10b2a..d36b1fab2 100644 --- a/platform_view_swift/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/platform_view_swift/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -107,6 +107,12 @@ "idiom" : "ipad", "filename" : "Icon-App-83.5x83.5@2x.png", "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" } ], "info" : { diff --git a/platform_view_swift/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/platform_view_swift/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 000000000..dc9ada472 Binary files /dev/null and b/platform_view_swift/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 000000000..0bedcf2fd --- /dev/null +++ b/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 000000000..89c2725b7 --- /dev/null +++ b/platform_view_swift/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/platform_view_swift/ios/Runner/Base.lproj/LaunchScreen.storyboard b/platform_view_swift/ios/Runner/Base.lproj/LaunchScreen.storyboard index ebf48f603..f2e259c7c 100644 --- a/platform_view_swift/ios/Runner/Base.lproj/LaunchScreen.storyboard +++ b/platform_view_swift/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -1,8 +1,8 @@ - + - + @@ -10,13 +10,20 @@ - - + + - - + + + + + + + + + @@ -24,4 +31,7 @@ + + + diff --git a/platform_view_swift/ios/Runner/Base.lproj/Main.storyboard b/platform_view_swift/ios/Runner/Base.lproj/Main.storyboard index ba4a4bfd5..3e2b56dae 100644 --- a/platform_view_swift/ios/Runner/Base.lproj/Main.storyboard +++ b/platform_view_swift/ios/Runner/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - - + + - + @@ -18,127 +18,13 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/platform_view_swift/ios/Runner/Info.plist b/platform_view_swift/ios/Runner/Info.plist index 3f06bd49a..83cff7fe1 100644 --- a/platform_view_swift/ios/Runner/Info.plist +++ b/platform_view_swift/ios/Runner/Info.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - en + $(DEVELOPMENT_LANGUAGE) CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + $(FLUTTER_BUILD_NAME) CFBundleSignature ???? CFBundleVersion - 1 + $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS UILaunchStoryboardName diff --git a/platform_view_swift/ios/Runner/PlatformViewController.swift b/platform_view_swift/ios/Runner/PlatformViewController.swift index dd1e8039a..1b992269e 100644 --- a/platform_view_swift/ios/Runner/PlatformViewController.swift +++ b/platform_view_swift/ios/Runner/PlatformViewController.swift @@ -6,32 +6,32 @@ import UIKit import Foundation protocol PlatformViewControllerDelegate { - func didUpdateCounter(counter: Int) + func didUpdateCounter(counter: Int) } class PlatformViewController : UIViewController { - var delegate: PlatformViewControllerDelegate? = nil - var counter: Int = 0 - - @IBOutlet weak var incrementLabel: UILabel! - - override func viewDidLoad() { - super.viewDidLoad() - setIncrementLabelText() - } - - func handleIncrement(_ sender: Any) { - self.counter += 1 - self.setIncrementLabelText() - } - - func switchToFlutterView(_ sender: Any) { - self.delegate?.didUpdateCounter(counter: self.counter) - dismiss(animated:false, completion:nil) - } - - func setIncrementLabelText() { - let text = String(format: "Button tapped %d %@", self.counter, (self.counter == 1) ? "time" : "times") - self.incrementLabel.text = text; - } + var delegate: PlatformViewControllerDelegate? = nil + var counter: Int = 0 + + @IBOutlet weak var incrementLabel: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + setIncrementLabelText() + } + + @IBAction func handleIncrement(_ sender: Any) { + self.counter += 1 + self.setIncrementLabelText() + } + + @IBAction func switchToFlutterView(_ sender: Any) { + self.delegate?.didUpdateCounter(counter: self.counter) + dismiss(animated:false, completion:nil) + } + + func setIncrementLabelText() { + let text = String(format: "Button tapped %d %@", self.counter, (self.counter == 1) ? "time" : "times") + self.incrementLabel.text = text; + } } diff --git a/platform_view_swift/ios/Runner/PlatformViewController.xib b/platform_view_swift/ios/Runner/PlatformViewController.xib new file mode 100644 index 000000000..2846ab577 --- /dev/null +++ b/platform_view_swift/ios/Runner/PlatformViewController.xib @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/platform_view_swift/ios/Runner/Runner-Bridging-Header.h b/platform_view_swift/ios/Runner/Runner-Bridging-Header.h index 308a2a560..7335fdf90 100644 --- a/platform_view_swift/ios/Runner/Runner-Bridging-Header.h +++ b/platform_view_swift/ios/Runner/Runner-Bridging-Header.h @@ -1 +1 @@ -#import "GeneratedPluginRegistrant.h" +#import "GeneratedPluginRegistrant.h" \ No newline at end of file diff --git a/platform_view_swift/ios/Runner/ic_add.png b/platform_view_swift/ios/Runner/ic_add.png deleted file mode 100644 index 23bf11921..000000000 Binary files a/platform_view_swift/ios/Runner/ic_add.png and /dev/null differ diff --git a/platform_view_swift/lib/main.dart b/platform_view_swift/lib/main.dart index 5e5cfec7f..113862879 100644 --- a/platform_view_swift/lib/main.dart +++ b/platform_view_swift/lib/main.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -18,85 +19,78 @@ class PlatformView extends StatelessWidget { theme: ThemeData( primarySwatch: Colors.grey, ), - home: const MyHomePage(title: 'Platform View'), + home: const HomePage(), ); } } -class MyHomePage extends StatefulWidget { - const MyHomePage({Key key, this.title}) : super(key: key); - - final String title; +class HomePage extends StatefulWidget { + const HomePage({ + Key key, + }) : super(key: key); @override - _MyHomePageState createState() => _MyHomePageState(); + _HomePageState createState() => _HomePageState(); } -class _MyHomePageState extends State { +class _HomePageState extends State { static const MethodChannel _methodChannel = - MethodChannel('samples.flutter.io/platform_view_swift'); + MethodChannel('dev.flutter.sample/platform_view_swift'); int _counter = 0; - void _incrementCounter() { - setState(() { - _counter++; - }); - } - - Future _launchPlatformCount() async { + Future _launchPlatformCount() async { final int platformCounter = await _methodChannel.invokeMethod('switchView', _counter); - setState(() { - _counter = platformCounter; - }); + setState(() => _counter = platformCounter); } @override - Widget build(BuildContext context) => Scaffold( - appBar: AppBar( - title: Text(widget.title), - ), - body: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'Button tapped $_counter time${_counter == 1 ? '' : 's'}.', - style: const TextStyle(fontSize: 17.0), - ), - Padding( - padding: const EdgeInsets.all(18.0), - child: RaisedButton( - child: const Text('Continue in iOS view'), - onPressed: _launchPlatformCount), - ), - ], - ), - ), - ), - Container( - padding: const EdgeInsets.only(bottom: 15.0, left: 5.0), - child: Row( - children: [ - Image.asset('assets/flutter-mark-square-64.png', scale: 1.5), - const Text( - 'Flutter', - style: TextStyle(fontSize: 30.0), + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Home page'), + ), + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Button tapped $_counter time${_counter == 1 ? '' : 's'}.', + style: Theme.of(context).textTheme.subtitle, + ), + SizedBox(height: 18), + RaisedButton( + child: const Text('Continue in iOS view'), + onPressed: _launchPlatformCount, ), ], ), ), - ], - ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), - ); + ), + Container( + padding: const EdgeInsets.only(bottom: 15, left: 5), + child: Row( + children: [ + FlutterLogo(), + Text( + 'Flutter', + style: Theme.of(context).textTheme.headline, + ), + ], + ), + ), + ], + ), + floatingActionButton: FloatingActionButton( + onPressed: () => setState(() => _counter++), + tooltip: 'Increment', + child: const Icon(Icons.add), + ), + ); + } } diff --git a/platform_view_swift/pubspec.lock b/platform_view_swift/pubspec.lock index bf43643ad..13809e8e0 100644 --- a/platform_view_swift/pubspec.lock +++ b/platform_view_swift/pubspec.lock @@ -1,6 +1,20 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.10" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.2" async: dependency: transitive description: @@ -29,6 +43,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.14.11" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" flutter: dependency: "direct main" description: flutter @@ -39,6 +74,13 @@ packages: description: flutter source: sdk version: "0.0.0" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" matcher: dependency: transitive description: @@ -61,12 +103,19 @@ packages: source: hosted version: "1.6.4" pedantic: - dependency: "direct dev" + dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted version: "1.8.0+1" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0" quiver: dependency: transitive description: @@ -135,5 +184,12 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "3.5.0" sdks: dart: ">=2.5.0 <3.0.0" diff --git a/platform_view_swift/pubspec.yaml b/platform_view_swift/pubspec.yaml index 1e61ce7c6..dbc2c0560 100644 --- a/platform_view_swift/pubspec.yaml +++ b/platform_view_swift/pubspec.yaml @@ -1,4 +1,8 @@ name: platform_view_swift +description: A new Flutter project. + +version: 1.0.0+1 + environment: sdk: ">=2.5.0 <3.0.0" @@ -6,12 +10,13 @@ dependencies: flutter: sdk: flutter + cupertino_icons: ^0.1.2 + dev_dependencies: flutter_test: sdk: flutter - pedantic: ^1.7.0 flutter: + uses-material-design: true - assets: - - assets/flutter-mark-square-64.png + diff --git a/platform_view_swift/test/widget_test.dart b/platform_view_swift/test/widget_test.dart new file mode 100644 index 000000000..52ad35664 --- /dev/null +++ b/platform_view_swift/test/widget_test.dart @@ -0,0 +1,9 @@ +// Copyright 2018, the Flutter project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('This test always passes', (tester) async {}); +} diff --git a/platform_view_swift/test/widgets_test.dart b/platform_view_swift/test/widgets_test.dart deleted file mode 100644 index f1181b0c4..000000000 --- a/platform_view_swift/test/widgets_test.dart +++ /dev/null @@ -1,11 +0,0 @@ -// This is a basic Flutter widget test. -// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter -// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to -// find child widgets in the widget tree, read text, and verify that the values of widget properties -// are correct. - -import 'package:flutter_test/flutter_test.dart'; - -void main() { - testWidgets('This test always passes', (tester) async {}); -}