Google 标记聚类。如何将这个库添加到项目中? Swift

Google Marker Clustering. How to add this lib to project? Swift

安装Google标记聚类库有多个说明,例如:https://developers.google.com/maps/documentation/ios-sdk/utility/setup https://github.com/googlemaps/google-maps-ios-utils/blob/master/Swift.md

但没有一个对我有用。此外,它们还存在一些矛盾。我尝试添加 pod,尝试添加桥接文件等。 我的 "import" 不知道聚类

我怎样才能让它发挥作用?

我找到了解决这个问题的方法。按照指南中提供的 Google 添加文件后,执行以下步骤:

  1. 创建文件"AppName-Bridging-Header.h".
  2. 像这样导入新库:

    #ifndef Bridging_Header_h

    #define Bridging_Header_h

    #import "GMUMarkerClustering.h"

    #import "GMUGeoJSONParser.h"

    #import "GMUKMLParser.h"

    #import "GMUGeometryRenderer.h"

    #endif /* Bridging_Header_h */

  3. 转到项目设置。

  4. 选择 "Targets" 字段和 "Build settings" 菜单。
  5. 搜索 "Swift compiler" 设置。
  6. 添加设置 "Objective-c bridging header" 和文件路径,在我的例子中:“AppName/App/AppName-Bridging-Header.h

完成!你的应用程序中有这个集群库。