Skip to content

Build Swift files in the engine to support Swift-only APIs on iOS and macOS #144791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jmagman opened this issue Mar 7, 2024 · 13 comments
Open
Assignees
Labels
engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list platform-ios iOS applications specifically platform-mac Building on or for macOS specifically team-engine Owned by Engine team triaged-engine Triaged by Engine team

Comments

@jmagman
Copy link
Member

jmagman commented Mar 7, 2024

Apple has and will continue to ship Swift-only APIs. We would be able to add Swift files to the iOS and macOS embedder and tests where necessary. Figure out what's needed to compile Swift files in the engine (toolchain, gn flags, other tooling).

@jmagman jmagman added platform-ios iOS applications specifically engine flutter/engine repository. See also e: labels. platform-mac Building on or for macOS specifically team-engine Owned by Engine team labels Mar 7, 2024
@jmagman
Copy link
Member Author

jmagman commented Mar 7, 2024

@dnfield
Copy link
Contributor

dnfield commented Mar 7, 2024

Can/should we use Xcode's swiftc?

Will this work with Goma/RBE?

@zanderso
Copy link
Member

zanderso commented Mar 7, 2024

We probably need not only a toolchain, but also we need to investigate any swift-specific GN features we'd need to use.

@jmagman jmagman changed the title Add Swift toolchain for engine builds to support Swift-only APIs on iOS and macOS Build Swift files in the engine to support Swift-only APIs on iOS and macOS Mar 7, 2024
@zanderso
Copy link
Member

Can/should we use Xcode's swiftc?

Initially we should copy whatever is in the Chrome buildroot. After that's working, we may want to use the Xcode version to help stay more up-to-date.

Will this work with Goma/RBE?

Likely not.

@jonahwilliams jonahwilliams added P2 Important issues not at the top of the work list triaged-engine Triaged by Engine team labels Mar 12, 2024
@jmagman
Copy link
Member Author

jmagman commented Mar 13, 2024

Initially we should copy whatever is in the Chrome buildroot.

Not sure if I'm in the right spot, but here's a python script accumulating swiftc flags:
https://chromium.googlesource.com/chromium/src/build/toolchain/+/d09c75d8838e04eb6d10264c868f51f5a548cd7c/ios/swiftc.py#425

DEPS src/third_party/swift-toolchain
https://chromium.googlesource.com/chromium/src/+/10f3782643a34cc8c02aea83b18339c25a71d5ff/DEPS#1778

swift-format for good measure (already running in packages repo: https://flutter-review.googlesource.com/c/recipes/+/54020 and flutter/packages#5928)
https://chromium.googlesource.com/chromium/src/+/10f3782643a34cc8c02aea83b18339c25a71d5ff/DEPS#1764

@jmagman
Copy link
Member Author

jmagman commented Dec 12, 2024

It's finally happened, there's a Swift-only API we need in the engine: #150392

@cbracken
Copy link
Member

cbracken commented Dec 12, 2024

I banged up a prototype of this a few weeks ago, but ran into a gn bug tracked here https://crbug.com/gn/380799198. My original bug report with details is here http://shortn/_KbylT3nDsZ.

Until that's fixed, we'd need to opt back in to using stamp files in gn as a workaround.

A question we need to consider is that Swift 5 is the first version of Swift to ship with a stable ABI. The first version of iOS to ship with Swift 5 runtime libs was iOS 13, but we support back to iOS 12. That means that for iOS 12 users, we'd be adding about 5MB of baggage to app size.

@zanderso
Copy link
Member

gn is pinned in the DEPS file at https://github.com/flutter/engine/blob/ec8326c115b2d6df6bb8432cd7e2db5f9a2226cc/DEPS#L711, which I'm sure is quite old. Were you updating it to a more recent version to get Swift support?

@cbracken
Copy link
Member

cbracken commented Dec 12, 2024

gn is pinned in the DEPS file at https://github.com/flutter/engine/blob/ec8326c115b2d6df6bb8432cd7e2db5f9a2226cc/DEPS#L711, which I'm sure is quite old. Were you updating it to a more recent version to get Swift support?

Swift support actually landed over the past couple years (though the documentation is poor). I did need to update to a newer version of gn locally in my prototype though (and my prototype wasn't in the engine repo but based off a personal gn template. The breakage mentioned earlier landed in gn in Sept.

So yeah, I'll likely to update gn as part of that work unless someone else wants to give that a shot independently.

EDIT: the SHA you mentioned (b79031308cc878488202beb99883ec1f2efd9a6d) is from Wed Nov 24 19:12:30 2021, so yes, we'll definitely need a newer version.

cbracken added a commit to cbracken/flutter_engine that referenced this issue Dec 12, 2024
In order to, at some future date, support building Swift in the engine,
we'll need an updated version of `gn`.

Note that all versions of `gn` after
f792b9756418af8ab8a91a4c15b582431cb86ff9 up to and including this
version are affected by a crasher when building Swift `source_set`
targets. The workaround to support Swift is to opt back in to stamp
files until the issue is fixed.

* Bug: https://crbug.com/gn/380799198
* Discussion: http://shortn/_KbylT3nDsZ

Either way, prior to this patch, we were using a version of gn from
2021, so we should probably update to a more recent version of `gn`
regardless.

Issue: flutter/flutter#144791
@cbracken
Copy link
Member

cbracken commented Dec 12, 2024

Sent a gn roll patch as a trial balloon: flutter/engine#57169

@cbracken cbracken self-assigned this Mar 7, 2025
cbracken added a commit to cbracken/flutter that referenced this issue Mar 7, 2025
Roll to tip-of-tree prior to testing Swift toolchain for macOS/iOS.

Issue: flutter#144791
github-merge-queue bot pushed a commit that referenced this issue Mar 7, 2025
Roll to tip-of-tree prior to testing Swift toolchain for macOS/iOS.

Issue: #144791


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

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
@cbracken
Copy link
Member

cbracken commented Mar 10, 2025

I’m actively working on this now. gn has been updated to tip-of-tree in #164806.

While I was experimenting with this back in November, I uncovered a gn bug (https://crbug.com/gn/380799198) that we'll need to work around by re-enabling stamp files until it's fixed in gn. Googlers can find details published at http://shortn/_KbylT3nDsZ.

Will update once I’ve got a proof of concept.

cbracken added a commit to cbracken/flutter that referenced this issue Mar 11, 2025
cbracken added a commit to cbracken/flutter that referenced this issue Mar 13, 2025
cbracken added a commit to cbracken/flutter that referenced this issue Mar 13, 2025
cbracken added a commit to cbracken/flutter that referenced this issue May 6, 2025
Support trailing closure syntax in FlutterRunLoop perform methods. This
allows us to write Swift code like:

```
FlutterRunLoop.mainLoop.perform(withDelay: delay) {
  // code.
}
```

Follow-up to flutter#168174.

Issue: flutter#144791
mboetger pushed a commit to mboetger/flutter that referenced this issue May 6, 2025
Enables the `swift` tool in the gn mac toolchain and wires up support
for Swift `source_set` targets. Ports `FlutterRunLoop` to Swift.

* Adds `//flutter/build/config/mac:compiler` config that sets up
`swiftflags` for the `swift` tool in the toolchain for macOS, and adds
it to the default configs on `is_mac` builds.

* Adds `mac_swift_lib_paths` in
`engine/src/build/config/apple/apple_sdk.gni` which holds the path of
Swift shared libraries for macOS targets. This is within the appropriate
`macosx` SDK directory within Xcode.

Finally, this code adds Swift code to the embedder and embedder tests as
proof of concept and to prevent regressions. This ports `FlutterRunLoop`
to Swift in order to verify Objective-C imports of Swift via the
bridging header.

Issue: flutter#144791

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

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
github-merge-queue bot pushed a commit that referenced this issue May 7, 2025
Support trailing closure syntax in FlutterRunLoop perform methods. This
allows us to write Swift code like:

```
FlutterRunLoop.mainLoop.perform(withDelay: delay) {
  // code.
}
```

This also matches the ordering used in NSRunLoop/RunLoop:
*
https://developer.apple.com/documentation/foundation/runloop/perform(inmodes:block:)?language=objc
*
https://developer.apple.com/documentation/foundation/runloop/perform(inmodes:block:)

Follow-up to #168174.

No tests since this is just a method rename.

Issue: #144791

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

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
@cbracken
Copy link
Member

Update is that we can now write Swift in the iOS and macOS embedders. We are not yet ready to expose any public API written in Swift, so this should be used for internal implementation code only.

github-merge-queue bot pushed a commit that referenced this issue May 15, 2025
In new Swift code in the iOS/macOS embedder, we currently lack core
features currently provided by shared internal C++ library code in FML.
This provides a logging implementation that can be used across the
iOS/macOS embedders, whether in Swift, Objective-C, or C++ code, and
migrates the iOS and macOS embedders to use it.

This patch also introduces gn support for authoring [Swift Testing][]
tests.
* Introduces a `SwiftTestingRunner` class that launches the Swift
Testing test runner, which runs all tests annotated with `@Test` linked
into the current executable.
* Introduces a `SwiftTestingRunnerMain` class that implements a main
entrypoint that launches the `SwiftTestingRunner`.
* Introduces a `gn` `source_set` target
(`//flutter/shell/platform/darwin/common:swift_testing_main`) that
includes the Swift Testing main entrypoint, such that `executable`
targets can add it to their deps to automatically be built as a Swift
Testing runner.
* Adds a `framework_common_swift_unittests` executable target for the
common framework unit tests, and wires that into the build and
`run_tests.py` for macOS.

Issue: #168564
Issue: #144791

[Swift Testing]: https://developer.apple.com/xcode/swift-testing/


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

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
cbracken added a commit to cbracken/flutter that referenced this issue May 15, 2025
This adds Obj-C/Swift bridging headers to Swift targets, which allows us
to use public Flutter framework API from Swift code in the framework.

This also restricts visibility of the Swift framework targets to the
corresponding framework target. The addition of a bridging header allows
us to use public framework types declared in those headers from Swift,
but those types are defined in the framework target, and thus using the
Swift target directly may result in linking errors in the user. Instead,
all usage of the Swift target should be transitive via the framework
target.

Issue: flutter#144791
@cbracken
Copy link
Member

As of #168929, this will be complete.

github-merge-queue bot pushed a commit that referenced this issue May 15, 2025
This adds Obj-C/Swift bridging headers to Swift targets, which allows us
to use public Flutter framework API from Swift code in the framework.

This also restricts visibility of the Swift framework targets to the
corresponding framework target. The addition of a bridging header allows
us to use public framework types declared in those headers from Swift,
but those types are defined in the framework target, and thus using the
Swift target directly may result in linking errors in the user. Instead,
all usage of the Swift target should be transitive via the framework
target.

Issue: #144791

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

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
cbracken added a commit to cbracken/flutter that referenced this issue May 15, 2025
This migrates FlutterResizeSynchronizer from an Objective-C
implementaton to a Swift implementation.

This is serves a couple purposes:
* adds the first Swift tests for the macOS embedder.
* adds Swift usage of the Logger I added in flutter#168568.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 15, 2025
This migrates FlutterResizeSynchronizer from an Objective-C
implementaton to a Swift implementation.

This is serves a couple purposes:
* adds the first Swift tests for the macOS embedder.
* adds Swift usage of the Logger I added in flutter#168568.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 16, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 16, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
  syntax in Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 16, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
  syntax in Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 16, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
  syntax in Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 16, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
  syntax in Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 16, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
  syntax in Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 16, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
  syntax in Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 16, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
  syntax in Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 16, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
  syntax in Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 16, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
  syntax in Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 16, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
  syntax in Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
cbracken added a commit to cbracken/flutter that referenced this issue May 16, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
  syntax in Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
github-merge-queue bot pushed a commit that referenced this issue May 18, 2025
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
syntax in Swift.
* adds an optional onTimeout parameter to
ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Admittedly, the original purpose was just to add a class that we could
write Swift tests for, but things got a bit out of hand.

Issue: #168564
Issue: #144791

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

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list platform-ios iOS applications specifically platform-mac Building on or for macOS specifically team-engine Owned by Engine team triaged-engine Triaged by Engine team
Projects
None yet
Development

No branches or pull requests

5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy