Skip to content

Commit b25170b

Browse files
committed
[google_maps_flutter_ios] improve obj-c documentation
1 parent b78f118 commit b25170b

File tree

8 files changed

+48
-58
lines changed

8 files changed

+48
-58
lines changed

packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
2BDE99378062AE3E60B40021 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3ACE0AFE8D82CD5962486AFD /* Pods_RunnerTests.framework */; };
1313
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
1414
478116522BEF8F47002F593E /* GoogleMapsPolylinesControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 478116512BEF8F47002F593E /* GoogleMapsPolylinesControllerTests.m */; };
15-
521AB0032B876A76005F460D /* ExtractIconFromDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 521AB0022B876A76005F460D /* ExtractIconFromDataTests.m */; };
16-
52E9C2AE2C5CEBD600078060 /* FLTClusterManagersControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E9C2AD2C5CEBD600078060 /* FLTClusterManagersControllerTests.m */; };
15+
528F16832C62941000148160 /* FGMClusterManagersControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 528F16822C62941000148160 /* FGMClusterManagersControllerTests.m */; };
16+
528F16872C62952700148160 /* ExtractIconFromDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 528F16862C62952700148160 /* ExtractIconFromDataTests.m */; };
1717
6851F3562835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */; };
1818
68E4726A2836FF0C00BDDDAC /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 68E472692836FF0C00BDDDAC /* MapKit.framework */; };
1919
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
@@ -65,9 +65,9 @@
6565
3ACE0AFE8D82CD5962486AFD /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6666
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
6767
478116512BEF8F47002F593E /* GoogleMapsPolylinesControllerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoogleMapsPolylinesControllerTests.m; sourceTree = "<group>"; };
68-
521AB0022B876A76005F460D /* ExtractIconFromDataTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExtractIconFromDataTests.m; sourceTree = "<group>"; };
68+
528F16822C62941000148160 /* FGMClusterManagersControllerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FGMClusterManagersControllerTests.m; sourceTree = "<group>"; };
69+
528F16862C62952700148160 /* ExtractIconFromDataTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExtractIconFromDataTests.m; sourceTree = "<group>"; };
6970
61A9A8623F5CA9BBC813DC6B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
70-
52E9C2AD2C5CEBD600078060 /* FLTClusterManagersControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FLTClusterManagersControllerTests.m; sourceTree = "<group>"; };
7171
6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLTGoogleMapJSONConversionsConversionTests.m; sourceTree = "<group>"; };
7272
68E472692836FF0C00BDDDAC /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/iOSSupport/System/Library/Frameworks/MapKit.framework; sourceTree = DEVELOPER_DIR; };
7373
733AFAB37683A9DA7512F09C /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
@@ -207,8 +207,8 @@
207207
isa = PBXGroup;
208208
children = (
209209
F269303A2BB389BF00BF17C4 /* assets */,
210-
52E9C2AF2C5CECD100078060 /* ExtractIconFromDataTests.m */,
211-
52E9C2AD2C5CEBD600078060 /* FGMClusterManagersControllerTests.m */,
210+
528F16862C62952700148160 /* ExtractIconFromDataTests.m */,
211+
528F16822C62941000148160 /* FGMClusterManagersControllerTests.m */,
212212
6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */,
213213
0DD7B6C22B744EEF00E857FD /* FLTTileProviderControllerTests.m */,
214214
F7151F12265D7ED70028CB91 /* GoogleMapsTests.m */,
@@ -511,13 +511,13 @@
511511
isa = PBXSourcesBuildPhase;
512512
buildActionMask = 2147483647;
513513
files = (
514+
528F16832C62941000148160 /* FGMClusterManagersControllerTests.m in Sources */,
514515
F7151F13265D7ED70028CB91 /* GoogleMapsTests.m in Sources */,
515-
52E9C2AE2C5CEBD600078060 /* FGMClusterManagersControllerTests.m in Sources */,
516516
6851F3562835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m in Sources */,
517517
982F2A6C27BADE17003C81F4 /* PartiallyMockedMapView.m in Sources */,
518518
478116522BEF8F47002F593E /* GoogleMapsPolylinesControllerTests.m in Sources */,
519519
0DD7B6C32B744EEF00E857FD /* FLTTileProviderControllerTests.m in Sources */,
520-
52E9C2B02C5CECD100078060 /* ExtractIconFromDataTests.m in Sources */,
520+
528F16872C62952700148160 /* ExtractIconFromDataTests.m in Sources */,
521521
);
522522
runOnlyForDeploymentPostprocessing = 0;
523523
};

packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMClusterManagersController.h

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,60 +10,51 @@
1010

1111
NS_ASSUME_NONNULL_BEGIN
1212

13-
// Defines cluster managers controller interface which
14-
// is responsible for adding/removing/returning one or more cluster managers.
13+
/// A controller that manages all of the cluster managers on a map.
1514
@interface FGMClusterManagersController : NSObject
1615

17-
/// Initializes FLTClusterManagersController.
16+
/// Initializes cluster manager controller.
1817
///
1918
/// @param callbackHandler A callback handler.
2019
/// @param mapView A map view that will be used to display clustered markers.
2120
- (instancetype)initWithMapView:(GMSMapView *)mapView
2221
callbackHandler:(FGMMapsCallbackApi *)callbackHandler;
2322

24-
/// Creates ClusterManagers and initializes them form JSON data.
23+
/// Creates cluster managers and initializes them form JSON data.
2524
///
26-
/// @param clusterManagersToAdd List of clustermanager object data.
25+
/// @param clusterManagersToAdd Array of cluster managers JSON data to add.
2726
- (void)addJSONClusterManagers:(NSArray<NSDictionary *> *)clusterManagersToAdd;
2827

29-
/// Creates ClusterManagers and initializes them.
28+
/// Creates cluster managers and initializes them.
3029
///
31-
/// @param clusterManagersToAdd List of clustermanager object data.
30+
/// @param clusterManagersToAdd Array of cluster managers to add.
3231
- (void)addClusterManagers:(NSArray<FGMPlatformClusterManager *> *)clusterManagersToAdd;
3332

34-
/// Removes requested ClusterManagers from the controller.
33+
/// Removes requested cluster managers from the controller.
3534
///
36-
/// @param identifiers List of clusterManagerIds to remove.
37-
35+
/// @param identifiers Array of cluster manager IDs to remove.
3836
- (void)removeClusterManagersWithIdentifiers:(NSArray<NSString *> *)identifiers;
3937

40-
/// Returns the ClusterManager for the given identifier.
38+
/// Returns the cluster managers for the given identifier.
4139
///
42-
/// @param identifier identifier of the ClusterManager.
43-
/// @return GMUClusterManager if found; otherwise, nil.
40+
/// @param identifier The identifier of the cluster manager.
41+
/// @return A cluster manager if found; otherwise, nil.
4442
- (nullable GMUClusterManager *)clusterManagerWithIdentifier:(NSString *)identifier;
4543

46-
/// Converts clusters managed by the specified ClusterManager to
47-
/// a serializable array of clusters.
48-
///
49-
/// This method fetches and serializes clusters at the current zoom
50-
/// level from the ClusterManager identified by the given identifier.
51-
/// If the specified ClusterManager identifier does not exist, an empty
52-
/// array is returned.
44+
/// Returns an array of clusters managed by the cluster manager.
5345
///
54-
/// @param identifier The identifier of the ClusterManager to serialize.
55-
/// @return An array of FGMPlatformCluster objects representing the clusters. `nil` is returned only
56-
/// when `error != nil`.
46+
/// @param identifier The identifier of the cluster manager whose clusters are to be retrieved.
47+
/// @return An array of clusters. Returns `nil` only if `error` is populated.
5748
- (nullable NSArray<FGMPlatformCluster *> *)
5849
clustersWithIdentifier:(NSString *)identifier
5950
error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error;
6051

61-
/// Called when cluster marker is tapped on the map.
52+
/// Called when a cluster marker is tapped on the map.
6253
///
63-
/// @param cluster GMUStaticCluster object.
54+
/// @param cluster The cluster that was tapped on.
6455
- (void)didTapCluster:(GMUStaticCluster *)cluster;
6556

66-
/// Calls cluster method of all ClusterManagers.
57+
/// Calls the cluster method of all the cluster managers.
6758
- (void)invokeClusteringForEachClusterManager;
6859
@end
6960

packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMClusterManagersController.m

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
@interface FGMClusterManagersController ()
1111

12-
/// A dictionary that cluster managers unique identifiers to GMUClusterManager instances.
12+
/// A dictionary mapping unique cluster manager identifiers to their corresponding cluster managers.
1313
@property(strong, nonatomic)
1414
NSMutableDictionary<NSString *, GMUClusterManager *> *clusterManagerIdentifierToManagers;
1515

1616
/// The callback handler interface for calls to Flutter.
1717
@property(strong, nonatomic) FGMMapsCallbackApi *callbackHandler;
1818

19-
/// The current GMSMapView instance on which the cluster managers are operating.
19+
/// The current map instance on which the cluster managers are operating.
2020
@property(strong, nonatomic) GMSMapView *mapView;
2121

2222
@end
@@ -53,10 +53,9 @@ - (void)addClusterManager:(NSString *)identifier {
5353
id<GMUClusterRenderer> renderer =
5454
[[GMUDefaultClusterRenderer alloc] initWithMapView:self.mapView
5555
clusterIconGenerator:iconGenerator];
56-
GMUClusterManager *clusterManager = [[GMUClusterManager alloc] initWithMap:self.mapView
57-
algorithm:algorithm
58-
renderer:renderer];
59-
self.clusterManagerIdentifierToManagers[identifier] = clusterManager;
56+
self.clusterManagerIdentifierToManagers[identifier] =
57+
[[GMUClusterManager alloc] initWithMap:self.mapView algorithm:algorithm renderer:renderer];
58+
;
6059
}
6160

6261
- (void)removeClusterManagersWithIdentifiers:(NSArray<NSString *> *)identifiers {
@@ -121,10 +120,9 @@ - (void)didTapCluster:(GMUStaticCluster *)cluster {
121120

122121
#pragma mark - Private methods
123122

124-
/// Returns the cluster manager id for given cluster.
123+
/// Returns the cluster manager identifier for given cluster.
125124
///
126-
/// @param cluster identifier of the ClusterManager.
127-
/// @return id NSString if found; otherwise, nil.
125+
/// @return The cluster manager identifier if found; otherwise, nil.
128126
- (nullable NSString *)clusterManagerIdentifierForCluster:(GMUStaticCluster *)cluster {
129127
if ([cluster.items.firstObject isKindOfClass:[GMSMarker class]]) {
130128
GMSMarker *firstMarker = (GMSMarker *)cluster.items.firstObject;

packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMMarkerUserData.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,20 @@ NS_ASSUME_NONNULL_BEGIN
1818

1919
@end
2020

21-
/// Sets MarkerId and optionally ClusterManagerId to GMSMarker UserData.
22-
///
23-
/// @param markerIdentifier Identifier of marker.
24-
/// @param clusterManagerIdentifier Optional identifier of cluster manager.
25-
/// @param marker GMSMarker object.
21+
/// Associates a marker identifier and optionally a cluster manager identifier with a marker's user
22+
/// data.
2623
extern void FGMSetIdentifiersToMarkerUserData(NSString *markerIdentifier,
2724
NSString *_Nullable clusterManagerIdentifier,
2825
GMSMarker *marker);
2926

30-
/// Get MarkerIdentifier from GMSMarker UserData.
27+
/// Get the marker identifier from marker's user data.
3128
///
32-
/// @param marker GMSMarker object.
33-
/// @return NSString if found; otherwise, nil.
29+
/// @return The marker identifier if found; otherwise, nil.
3430
extern NSString *_Nullable FGMGetMarkerIdentifierFromMarker(GMSMarker *marker);
3531

36-
/// Get ClusterManagerIdentifier from GMSMarker UserData.
32+
/// Get the cluster manager identifier from marker's user data.
3733
///
38-
/// @param marker GMSMarker object.
39-
/// @return NSString if found; otherwise, nil.
34+
/// @return The cluster manager identifier if found; otherwise, nil.
4035
extern NSString *_Nullable FGMGetClusterManagerIdentifierFromMarker(GMSMarker *marker);
4136

4237
NS_ASSUME_NONNULL_END

packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapsPlugin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#import <Flutter/Flutter.h>
66
#import <GoogleMaps/GoogleMaps.h>
7+
78
#import "FGMClusterManagersController.h"
89
#import "GoogleMapCircleController.h"
910
#import "GoogleMapController.h"

packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#import <Flutter/Flutter.h>
6-
#import <GoogleMaps/GoogleMaps.h>
75
#import "FGMClusterManagersController.h"
86
#import "GoogleMapCircleController.h"
97
#import "GoogleMapMarkerController.h"
108
#import "GoogleMapPolygonController.h"
119
#import "GoogleMapPolylineController.h"
10+
11+
#import <Flutter/Flutter.h>
12+
#import <GoogleMaps/GoogleMaps.h>
13+
1214
#import "messages.g.h"
1315

1416
NS_ASSUME_NONNULL_BEGIN

packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapMarkerController.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#import <Flutter/Flutter.h>
6-
#import <GoogleMaps/GoogleMaps.h>
75
#import "FGMClusterManagersController.h"
86
#import "GoogleMapController.h"
7+
8+
#import <Flutter/Flutter.h>
9+
#import <GoogleMaps/GoogleMaps.h>
10+
911
#import "messages.g.h"
1012

1113
NS_ASSUME_NONNULL_BEGIN

packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapMarkerController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// found in the LICENSE file.
44

55
#import "GoogleMapMarkerController.h"
6+
67
#import "FGMMarkerUserData.h"
78
#import "FLTGoogleMapJSONConversions.h"
89

0 commit comments

Comments
 (0)