Add Benchmarks and examples to compare swiftui and flutter (#160681)

Partially addresses https://github.com/flutter/flutter/issues/154138,
specifically
[#162025](https://github.com/flutter/flutter/issues/162025),
[#162026](https://github.com/flutter/flutter/issues/162026),
[#162028](https://github.com/flutter/flutter/issues/162028),
[#162029](https://github.com/flutter/flutter/issues/162029)

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
This commit is contained in:
LouiseHsu 2025-02-03 16:07:19 -08:00 committed by GitHub
parent b8fd23c76f
commit 2c145cea51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 1046 additions and 0 deletions

View File

@ -4852,6 +4852,26 @@ targets:
["devicelab", "ios", "mac", "arm64"]
task_name: hello_world_ios__compile
- name: Mac_arm64_ios imitation_game_flutter
recipe: devicelab/devicelab_drone
presubmit: false
bringup: true
timeout: 60
properties:
tags: >
["devicelab", "ios", "mac", "arm64"]
task_name: imitation_game_swiftui__compile
- name: Mac_arm64_ios imitation_game_swiftui
recipe: devicelab/devicelab_drone
presubmit: false
bringup: true
timeout: 60
properties:
tags: >
["devicelab", "ios", "mac", "arm64"]
task_name: imitation_game_flutter__compile
- name: Mac_x64 hot_mode_dev_cycle_macos_target__benchmark
recipe: devicelab/devicelab_drone
timeout: 60

View File

@ -186,6 +186,8 @@
/dev/devicelab/bin/tasks/fullscreen_textfield_perf_ios__e2e_summary.dart @louisehsu @flutter/engine
/dev/devicelab/bin/tasks/hello_world_ios__compile.dart @jmagman @flutter/engine
/dev/devicelab/bin/tasks/hot_mode_dev_cycle_ios__benchmark.dart @louisehsu @flutter/tool
/dev/devicelab/bin/tasks/imitation_game_flutter__compile.dart @louisehsu @flutter/tool
/dev/devicelab/bin/tasks/imitation_game_swiftui__compile.dart @louisehsu @flutter/tool
# TODO(vashworth): Remove once https://github.com/flutter/flutter/issues/142305 is fixed.
/dev/devicelab/bin/tasks/hot_mode_dev_cycle_ios__benchmark_no_dds.dart @louisehsu @flutter/tool
/dev/devicelab/bin/tasks/imagefiltered_transform_animation_perf_ios__timeline_summary.dart @hellohuanlin @flutter/engine

View File

@ -0,0 +1,48 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# 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/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
# Benchmark related
/ios/

View File

@ -0,0 +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.
version:
revision: "fea58103a27a000ee3c91851585e77336f65806f"
channel: "[user-branch]"
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: fea58103a27a000ee3c91851585e77336f65806f
base_revision: fea58103a27a000ee3c91851585e77336f65806f
- platform: ios
create_revision: fea58103a27a000ee3c91851585e77336f65806f
base_revision: fea58103a27a000ee3c91851585e77336f65806f
# 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'

View File

@ -0,0 +1,2 @@
This is the example Flutter app used to compare performance to a equivalent SwiftUI app.
See here for more info: https://github.com/flutter/flutter/issues/154138

View File

@ -0,0 +1,28 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View File

@ -0,0 +1,82 @@
// Copyright 2014 The Flutter Authors. 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/material.dart';
void main() {
runApp(InfiniteScrollApp());
}
class InfiniteScrollApp extends StatelessWidget {
const InfiniteScrollApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Infinite Scrolling Flutter',
home: InfiniteScrollList(),
);
}
}
class InfiniteScrollList extends StatefulWidget {
const InfiniteScrollList({super.key});
@override
InfiniteScrollListState createState() => InfiniteScrollListState();
}
class InfiniteScrollListState extends State<InfiniteScrollList> {
final List<String> items = [];
final int itemsPerPage = 20;
final List<String> staticData = [
"Hello Flutter",
"Hello Flutter",
"Hello Flutter",
"Hello Flutter",
"Hello Flutter",
];
@override
void initState() {
super.initState();
_loadMoreData(); // Load initial data
}
void _loadMoreData() {
setState(() {
final newItems = List.generate(itemsPerPage, (i) {
return staticData[i % staticData.length];
});
items.addAll(newItems);
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Infinite Scrolling ListView (Static Data)"),
),
body: NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification scrollInfo) {
if (scrollInfo.metrics.pixels >=
scrollInfo.metrics.maxScrollExtent - 50) {
_loadMoreData();
return true;
}
return false;
},
child: ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
return ListTile(title: Text(items[index]));
},
),
),
),
);
}
}

View File

@ -0,0 +1,47 @@
name: hello_world_flutter
description: "A new Flutter project."
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ^3.7.0-208.0.dev
dependencies:
flutter:
sdk: flutter
cupertino_icons: 1.0.8
characters: 1.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
collection: 1.19.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
material_color_utilities: 0.11.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
meta: 1.16.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: 5.0.0
async: 2.12.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
boolean_selector: 2.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
clock: 1.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
fake_async: 1.3.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
leak_tracker: 10.0.9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
leak_tracker_flutter_testing: 3.0.9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
leak_tracker_testing: 3.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
lints: 5.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
matcher: 0.12.17 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
path: 1.9.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_span: 1.10.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stack_trace: 1.12.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stream_channel: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.7.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vm_service: 15.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
flutter:
uses-material-design: true
# PUBSPEC CHECKSUM: 1f28

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>destination</key>
<string>export</string>
<key>method</key>
<string>ad-hoc</string>
<key>signingStyle</key>
<string>automatic</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>S8QB4VV633</string>
<key>thinning</key>
<string>&lt;none&gt;</string>
</dict>
</plist>

View File

@ -0,0 +1,2 @@
This is the example SwiftUI app used to compare performance to a equivalent Flutter app.
See here for more info: https://github.com/flutter/flutter/issues/154138

View File

@ -0,0 +1,563 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
F241F5062D08EE8800C053B5 /* hello_world_swiftuiApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F241F5052D08EE8800C053B5 /* hello_world_swiftuiApp.swift */; };
F241F5082D08EE8800C053B5 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F241F5072D08EE8800C053B5 /* ContentView.swift */; };
F241F50A2D08EE8900C053B5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F241F5092D08EE8900C053B5 /* Assets.xcassets */; };
F241F50D2D08EE8900C053B5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F241F50C2D08EE8900C053B5 /* Preview Assets.xcassets */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
F241F5132D08EE8900C053B5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = F241F4FA2D08EE8800C053B5 /* Project object */;
proxyType = 1;
remoteGlobalIDString = F241F5012D08EE8800C053B5;
remoteInfo = hello_world_swiftui;
};
F241F51D2D08EE8900C053B5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = F241F4FA2D08EE8800C053B5 /* Project object */;
proxyType = 1;
remoteGlobalIDString = F241F5012D08EE8800C053B5;
remoteInfo = hello_world_swiftui;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
F241F5022D08EE8800C053B5 /* hello_world_swiftui.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = hello_world_swiftui.app; sourceTree = BUILT_PRODUCTS_DIR; };
F241F5052D08EE8800C053B5 /* hello_world_swiftuiApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = hello_world_swiftuiApp.swift; sourceTree = "<group>"; };
F241F5072D08EE8800C053B5 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
F241F5092D08EE8900C053B5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
F241F50C2D08EE8900C053B5 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
F241F5122D08EE8900C053B5 /* hello_world_swiftuiTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = hello_world_swiftuiTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
F241F51C2D08EE8900C053B5 /* hello_world_swiftuiUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = hello_world_swiftuiUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
F241F4FF2D08EE8800C053B5 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
F241F50F2D08EE8900C053B5 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
F241F5192D08EE8900C053B5 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
F241F4F92D08EE8800C053B5 = {
isa = PBXGroup;
children = (
F241F5042D08EE8800C053B5 /* hello_world_swiftui */,
F241F5032D08EE8800C053B5 /* Products */,
);
sourceTree = "<group>";
};
F241F5032D08EE8800C053B5 /* Products */ = {
isa = PBXGroup;
children = (
F241F5022D08EE8800C053B5 /* hello_world_swiftui.app */,
F241F5122D08EE8900C053B5 /* hello_world_swiftuiTests.xctest */,
F241F51C2D08EE8900C053B5 /* hello_world_swiftuiUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
F241F5042D08EE8800C053B5 /* hello_world_swiftui */ = {
isa = PBXGroup;
children = (
F241F5052D08EE8800C053B5 /* hello_world_swiftuiApp.swift */,
F241F5072D08EE8800C053B5 /* ContentView.swift */,
F241F5092D08EE8900C053B5 /* Assets.xcassets */,
F241F50B2D08EE8900C053B5 /* Preview Content */,
);
path = hello_world_swiftui;
sourceTree = "<group>";
};
F241F50B2D08EE8900C053B5 /* Preview Content */ = {
isa = PBXGroup;
children = (
F241F50C2D08EE8900C053B5 /* Preview Assets.xcassets */,
);
path = "Preview Content";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
F241F5012D08EE8800C053B5 /* hello_world_swiftui */ = {
isa = PBXNativeTarget;
buildConfigurationList = F241F5262D08EE8900C053B5 /* Build configuration list for PBXNativeTarget "hello_world_swiftui" */;
buildPhases = (
F241F4FE2D08EE8800C053B5 /* Sources */,
F241F4FF2D08EE8800C053B5 /* Frameworks */,
F241F5002D08EE8800C053B5 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = hello_world_swiftui;
productName = hello_world_swiftui;
productReference = F241F5022D08EE8800C053B5 /* hello_world_swiftui.app */;
productType = "com.apple.product-type.application";
};
F241F5112D08EE8900C053B5 /* hello_world_swiftuiTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = F241F5292D08EE8900C053B5 /* Build configuration list for PBXNativeTarget "hello_world_swiftuiTests" */;
buildPhases = (
F241F50E2D08EE8900C053B5 /* Sources */,
F241F50F2D08EE8900C053B5 /* Frameworks */,
F241F5102D08EE8900C053B5 /* Resources */,
);
buildRules = (
);
dependencies = (
F241F5142D08EE8900C053B5 /* PBXTargetDependency */,
);
name = hello_world_swiftuiTests;
productName = hello_world_swiftuiTests;
productReference = F241F5122D08EE8900C053B5 /* hello_world_swiftuiTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
F241F51B2D08EE8900C053B5 /* hello_world_swiftuiUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = F241F52C2D08EE8900C053B5 /* Build configuration list for PBXNativeTarget "hello_world_swiftuiUITests" */;
buildPhases = (
F241F5182D08EE8900C053B5 /* Sources */,
F241F5192D08EE8900C053B5 /* Frameworks */,
F241F51A2D08EE8900C053B5 /* Resources */,
);
buildRules = (
);
dependencies = (
F241F51E2D08EE8900C053B5 /* PBXTargetDependency */,
);
name = hello_world_swiftuiUITests;
productName = hello_world_swiftuiUITests;
productReference = F241F51C2D08EE8900C053B5 /* hello_world_swiftuiUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
F241F4FA2D08EE8800C053B5 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1540;
LastUpgradeCheck = 1540;
TargetAttributes = {
F241F5012D08EE8800C053B5 = {
CreatedOnToolsVersion = 15.4;
};
F241F5112D08EE8900C053B5 = {
CreatedOnToolsVersion = 15.4;
TestTargetID = F241F5012D08EE8800C053B5;
};
F241F51B2D08EE8900C053B5 = {
CreatedOnToolsVersion = 15.4;
TestTargetID = F241F5012D08EE8800C053B5;
};
};
};
buildConfigurationList = F241F4FD2D08EE8800C053B5 /* Build configuration list for PBXProject "hello_world_swiftui" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = F241F4F92D08EE8800C053B5;
productRefGroup = F241F5032D08EE8800C053B5 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
F241F5012D08EE8800C053B5 /* hello_world_swiftui */,
F241F5112D08EE8900C053B5 /* hello_world_swiftuiTests */,
F241F51B2D08EE8900C053B5 /* hello_world_swiftuiUITests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
F241F5002D08EE8800C053B5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F241F50D2D08EE8900C053B5 /* Preview Assets.xcassets in Resources */,
F241F50A2D08EE8900C053B5 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F241F5102D08EE8900C053B5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
F241F51A2D08EE8900C053B5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
F241F4FE2D08EE8800C053B5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F241F5082D08EE8800C053B5 /* ContentView.swift in Sources */,
F241F5062D08EE8800C053B5 /* hello_world_swiftuiApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F241F50E2D08EE8900C053B5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
F241F5182D08EE8900C053B5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
F241F5142D08EE8900C053B5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = F241F5012D08EE8800C053B5 /* hello_world_swiftui */;
targetProxy = F241F5132D08EE8900C053B5 /* PBXContainerItemProxy */;
};
F241F51E2D08EE8900C053B5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = F241F5012D08EE8800C053B5 /* hello_world_swiftui */;
targetProxy = F241F51D2D08EE8900C053B5 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
F241F5242D08EE8900C053B5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
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;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
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 = 17.5;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
F241F5252D08EE8900C053B5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
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;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
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 = 17.5;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
F241F5272D08EE8900C053B5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"hello_world_swiftui/Preview Content\"";
DEVELOPMENT_TEAM = S8QB4VV633;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "dev.flutter.plugins.hello-world-swiftui";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
F241F5282D08EE8900C053B5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"hello_world_swiftui/Preview Content\"";
DEVELOPMENT_TEAM = S8QB4VV633;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "dev.flutter.plugins.hello-world-swiftui";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
F241F52A2D08EE8900C053B5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = S8QB4VV633;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.5;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "dev.flutter.plugins.hello-world-swiftuiTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/hello_world_swiftui.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/hello_world_swiftui";
};
name = Debug;
};
F241F52B2D08EE8900C053B5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = S8QB4VV633;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.5;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "dev.flutter.plugins.hello-world-swiftuiTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/hello_world_swiftui.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/hello_world_swiftui";
};
name = Release;
};
F241F52D2D08EE8900C053B5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = S8QB4VV633;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "dev.flutter.plugins.hello-world-swiftuiUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = hello_world_swiftui;
};
name = Debug;
};
F241F52E2D08EE8900C053B5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = S8QB4VV633;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "dev.flutter.plugins.hello-world-swiftuiUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = hello_world_swiftui;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
F241F4FD2D08EE8800C053B5 /* Build configuration list for PBXProject "hello_world_swiftui" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F241F5242D08EE8900C053B5 /* Debug */,
F241F5252D08EE8900C053B5 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F241F5262D08EE8900C053B5 /* Build configuration list for PBXNativeTarget "hello_world_swiftui" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F241F5272D08EE8900C053B5 /* Debug */,
F241F5282D08EE8900C053B5 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F241F5292D08EE8900C053B5 /* Build configuration list for PBXNativeTarget "hello_world_swiftuiTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F241F52A2D08EE8900C053B5 /* Debug */,
F241F52B2D08EE8900C053B5 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F241F52C2D08EE8900C053B5 /* Build configuration list for PBXNativeTarget "hello_world_swiftuiUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F241F52D2D08EE8900C053B5 /* Debug */,
F241F52E2D08EE8900C053B5 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = F241F4FA2D08EE8800C053B5 /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,49 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import SwiftUI
struct ContentView: View {
@State private var items: [String] = Array(repeating: "Hello", count: 50)
@State private var isLoadingMore = false
private let fetchThreshold = 5
var body: some View {
NavigationView { // Add a NavigationView for better view management
List {
ForEach(items.indices, id: \.self) { index in
Text(items[index])
.onAppear {
if index == items.count - fetchThreshold {
loadMoreContent()
}
}
}
if isLoadingMore {
ProgressView()
.frame(maxWidth: .infinity) // Center the indicator
}
}
.navigationTitle("Infinite Scroll") // Set a title for clarity
}
}
func loadMoreContent() {
if isLoadingMore {
return
}
isLoadingMore = true
let newItems = Array(repeating: "Hello", count: 20) // Fetch 20 more items
items.append(contentsOf: newItems)
isLoadingMore = false
}
}
#Preview {
ContentView()
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,14 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import SwiftUI
@main
struct hello_world_swiftuiApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}

View File

@ -0,0 +1,12 @@
// Copyright 2014 The Flutter Authors. 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_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createImitationGameFlutterTest());
}

View File

@ -0,0 +1,12 @@
// Copyright 2014 The Flutter Authors. 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_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createImitationGameSwiftUITest());
}

View File

@ -280,6 +280,28 @@ TaskFunction createHelloWorldCompileTest() {
).run;
}
TaskFunction createImitationGameSwiftUITest() {
return CompileTest(
'${flutterDirectory.path}/dev/benchmarks/imitation_game_swiftui',
reportPackageContentSizes: true,
).runSwiftUIApp;
}
TaskFunction createImitationGameFlutterTest() {
flutter(
'create',
options: <String>[
'--platforms=ios',
'${flutterDirectory.path}/dev/benchmarks/imitation_game_flutter',
'--no-overwrite',
],
);
return CompileTest(
'${flutterDirectory.path}/dev/benchmarks/imitation_game_flutter',
reportPackageContentSizes: true,
).run;
}
TaskFunction createWebCompileTest() {
return const WebCompileTest().run;
}
@ -1687,6 +1709,50 @@ class CompileTest {
});
}
Future<TaskResult> runSwiftUIApp() async {
return inDirectory<TaskResult>(testDirectory, () async {
await Process.run('xcodebuild', <String>['clean', '-allTargets']);
int releaseSizeInBytes = 0;
final Stopwatch watch = Stopwatch();
watch.start();
await Process.run(workingDirectory: testDirectory, 'xcodebuild', <String>[
'-scheme',
'hello_world_swiftui',
'-target',
'hello_world_swiftui',
'-sdk',
'iphoneos',
'-configuration',
'Release',
'-archivePath',
'$testDirectory/hello_world_swiftui',
'archive',
]).then((ProcessResult results) {
watch.stop();
print(results.stdout);
if (results.exitCode != 0) {
print(results.stderr);
}
});
final String appPath =
'$testDirectory/hello_world_swiftui.xcarchive/Products/Applications/hello_world_swiftui.app';
// Zip up the .app file to get an approximation of the .ipa size.
await exec('tar', <String>['-zcf', 'app.tar.gz', appPath]);
releaseSizeInBytes = await file('$testDirectory/app.tar.gz').length();
final Map<String, dynamic> metrics = <String, dynamic>{};
metrics.addAll(<String, dynamic>{
'release_swiftui_compile_millis': watch.elapsedMilliseconds,
'release_swiftui_size_bytes': releaseSizeInBytes,
});
return TaskResult.success(metrics);
});
}
Future<Map<String, dynamic>> _compileApp({required bool deleteGradleCache}) async {
await flutter('clean');
if (deleteGradleCache) {