diff --git a/platform_view_swift/.metadata b/platform_view_swift/.metadata index aeb01ee243c..5df5c7a0ea6 100644 --- a/platform_view_swift/.metadata +++ b/platform_view_swift/.metadata @@ -1,10 +1,30 @@ # 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. +# This file should be version controlled. version: - revision: 2d2a1ffec95cc70a3218872a2cd3f8de4933c42f + revision: f1875d570e39de09040c8f79aa13cc56baab8db1 channel: stable project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 + base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 + - platform: ios + create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 + base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/platform_view_swift/codelab_rebuild.yaml b/platform_view_swift/codelab_rebuild.yaml new file mode 100644 index 00000000000..af0193ade6a --- /dev/null +++ b/platform_view_swift/codelab_rebuild.yaml @@ -0,0 +1,169 @@ +# Run with tooling from https://github.com/flutter/codelabs/tree/main/tooling/codelab_rebuild +name: Platform Design rebuild script +steps: + - name: Remove runner + rmdirs: + - ios + - name: Flutter recreate runner + flutter: create --platform ios --org dev.flutter . + - name: Replace ios/Runner/AppDelegate.swift + path: ios/Runner/AppDelegate.swift + replace-contents: | + // 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 UIKit + import Flutter + + @UIApplicationMain + @objc class AppDelegate: FlutterAppDelegate, PlatformViewControllerDelegate { + var flutterResult: FlutterResult? + + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: 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) + } + } + - name: Replace ios/Runner/PlatformViewController.swift + path: ios/Runner/PlatformViewController.swift + replace-contents: | + // 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 UIKit + import Foundation + + protocol PlatformViewControllerDelegate { + 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() + } + + @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; + } + } + + - name: Replace ios/Runner/PlatformViewController.xib + path: ios/Runner/PlatformViewController.xib + replace-contents: | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + # TODO(DomesticMouse): Figure out a way to patch ios/Runner.xcodeproj/project.pbxproj + - name: Flutter doctor + flutter: doctor + - name: Build for iOS + flutter: build ios --simulator \ No newline at end of file diff --git a/platform_view_swift/ios/.gitignore b/platform_view_swift/ios/.gitignore index e96ef602b8d..7a7f9873ad7 100644 --- a/platform_view_swift/ios/.gitignore +++ b/platform_view_swift/ios/.gitignore @@ -1,3 +1,4 @@ +**/dgph *.mode1v3 *.mode2v3 *.moved-aside @@ -18,6 +19,7 @@ Flutter/App.framework Flutter/Flutter.framework Flutter/Flutter.podspec Flutter/Generated.xcconfig +Flutter/ephemeral/ Flutter/app.flx Flutter/app.zip Flutter/flutter_assets/ diff --git a/platform_view_swift/ios/Flutter/AppFrameworkInfo.plist b/platform_view_swift/ios/Flutter/AppFrameworkInfo.plist index 6b4c0f78a78..8d4492f977a 100644 --- a/platform_view_swift/ios/Flutter/AppFrameworkInfo.plist +++ b/platform_view_swift/ios/Flutter/AppFrameworkInfo.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable App CFBundleIdentifier @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 8.0 + 9.0 diff --git a/platform_view_swift/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/platform_view_swift/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a16ed0..919434a6254 100644 --- a/platform_view_swift/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/platform_view_swift/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/platform_view_swift/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/platform_view_swift/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000000..18d981003d6 --- /dev/null +++ b/platform_view_swift/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/platform_view_swift/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/platform_view_swift/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000000..f9b0d7c5ea1 --- /dev/null +++ b/platform_view_swift/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + 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 a28140cfdb3..c87d15a3352 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 @@ - - - - + + - - + + + + PreviewsEnabled + + + diff --git a/platform_view_swift/ios/Runner/Info.plist b/platform_view_swift/ios/Runner/Info.plist index 83cff7fe155..c07685c079e 100644 --- a/platform_view_swift/ios/Runner/Info.plist +++ b/platform_view_swift/ios/Runner/Info.plist @@ -4,6 +4,8 @@ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Platform View Swift CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -41,5 +43,7 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone +