1
0
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:
LouiseHsu
2026-09-30 11:27:28 -07:00
committed by GitHub
parent 8a4cf1db16
commit a05867daaa
55 changed files with 811 additions and 268 deletions

View File

@@ -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 {
}

View File

@@ -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

View File

@@ -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.