Repository navigation
Commit 0ad8af3
authored
[google_maps_flutter] Convert heatmap controller to Swift (flutter#12713)
This converts HeatmapController and the remaining utility functions to Swift in the `_sdk*` packages.
The final remaining Obj-C code will be migrated in a follow-up PRs.
The conversion process was:
- Initial conversion via Gemini, with explicit instruction to keep the structure the same.
- Side-by-side manual review of the old and new versions of the files.
- Manual fixes and improvements.
The conversion code utils have much more change than previous PRs, since the direct conversion code felt very non-idiomatic in Swift. Almost all of the free functions for Pigeon<->Maps SDK type conversions were converted to extensions on the Pigeon types:
- To avoid the fragile pattern of putting extension methods on types we don't control (which can lead to collisions), all the extensions are on the Pigeon types, and so the APIs aren't symmetrical:
- Maps -> Pigeon is done via a convenience constructor (generally called `make(from:)`
- Pigeon -> Maps is done via a `toMapsSDKClassName()` method on the Pigeon type (I'm not sold on that naming pattern; alternate suggestions welcome)
- Conversions functions that were array-based have been changed to single-element conversions following the pattern above, and then the call sites changed to just `map` that conversion function, since `map` is a simple and idiomatic pattern in Swift, unlike the loop-and-add construction that had been required in Obj-C.
- This in turn caused some tests to be simplified, since we didn't need to test things like the number of list items converted, and can instead just test the individual conversion.
The test bridging header is removed since there are no longer any `_Test` headers.
Part of flutter#119108
## Pre-Review Checklist
[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.1 parent bfc3b6c commit 0ad8af3
102 files changed
Lines changed: 2539 additions & 3448 deletions
File tree
- packages/google_maps_flutter
- google_maps_flutter_ios_sdk10
- example/ios
- Runner.xcodeproj
- RunnerTests
- TestUtils
- ios/google_maps_flutter_ios_sdk10/Sources
- google_maps_flutter_ios_sdk10_objc
- include/google_maps_flutter_ios_sdk10_objc
- google_maps_flutter_ios_sdk10
- google_maps_flutter_ios_sdk9
- example/ios
- Runner.xcodeproj
- RunnerTests
- TestUtils
- ios/google_maps_flutter_ios_sdk9/Sources
- google_maps_flutter_ios_sdk9_objc
- include/google_maps_flutter_ios_sdk9_objc
- google_maps_flutter_ios_sdk9
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
| |||
208 | 207 | | |
209 | 208 | | |
210 | 209 | | |
211 | | - | |
212 | 210 | | |
213 | 211 | | |
214 | 212 | | |
| |||
649 | 647 | | |
650 | 648 | | |
651 | 649 | | |
652 | | - | |
653 | 650 | | |
654 | 651 | | |
655 | 652 | | |
| |||
670 | 667 | | |
671 | 668 | | |
672 | 669 | | |
673 | | - | |
674 | 670 | | |
675 | 671 | | |
676 | 672 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
0 commit comments