mirror of
https://github.com/flutter/samples.git
synced 2026-10-11 13:42:04 +00:00
Migrate standard sample apps to UIScene lifecycle (#2884)
Fixes https://github.com/flutter/flutter/issues/176957
This commit is contained in:
@@ -2,31 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import Flutter
|
||||
import UIKit
|
||||
|
||||
/// The UIWindowSceneDelegate for the app.
|
||||
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
var window: UIWindow?
|
||||
|
||||
func scene(
|
||||
_ scene: UIScene, willConnectTo session: UISceneSession,
|
||||
options connectionOptions: UIScene.ConnectionOptions
|
||||
) {
|
||||
guard let _ = (scene as? UIWindowScene) else { return }
|
||||
}
|
||||
|
||||
func sceneDidDisconnect(_ scene: UIScene) {
|
||||
}
|
||||
|
||||
func sceneDidBecomeActive(_ scene: UIScene) {
|
||||
}
|
||||
|
||||
func sceneWillResignActive(_ scene: UIScene) {
|
||||
}
|
||||
|
||||
func sceneWillEnterForeground(_ scene: UIScene) {
|
||||
}
|
||||
|
||||
func sceneDidEnterBackground(_ scene: UIScene) {
|
||||
}
|
||||
class SceneDelegate: FlutterSceneDelegate {
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class SingleFlutterViewController: FlutterViewController, DataModelObserver {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
channel = FlutterMethodChannel(
|
||||
name: "multiple-flutters", binaryMessenger: self.engine!.binaryMessenger)
|
||||
name: "multiple-flutters", binaryMessenger: self.engine.binaryMessenger)
|
||||
channel!.invokeMethod("setCount", arguments: DataModel.shared.count)
|
||||
let navController = self.navigationController!
|
||||
channel!.setMethodCallHandler { (call: FlutterMethodCall, result: @escaping FlutterResult) in
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
platform :ios, '15.0'
|
||||
|
||||
# Copyright 2021 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.
|
||||
|
||||
Reference in New Issue
Block a user