Skip to content
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

chore: Clean up Objc files, OCMock & dependency from feature/Cluster-QuadTree-Heatmap-Geometry-swift branch. #526

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
"revision" : "0cd72dd45109b0225dd920ff17e0362a96489ec0",
"version" : "9.0.0"
}
},
{
"identity" : "ocmock",
"kind" : "remoteSourceControl",
"location" : "https://github.com/erikdoe/ocmock.git",
"state" : {
"revision" : "fe1661a3efed11831a6452f4b1a0c5e6ddc08c3d"
}
}
],
"version" : 2
Expand Down
42 changes: 2 additions & 40 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,62 +24,24 @@ let package = Package(
products: [
.library(
name: "GoogleMapsUtils",
targets: ["GoogleMapsUtils", "GoogleMapsUtilsObjC"]),
targets: ["GoogleMapsUtils"]),
],
dependencies: [
.package(
url: "https://github.com/googlemaps/ios-maps-sdk",
from: "9.0.0"),
.package(
url: "https://github.com/erikdoe/ocmock.git",
revision: "fe1661a3efed11831a6452f4b1a0c5e6ddc08c3d"),
from: "9.0.0")
],
targets: [
.target(
name: "GoogleMapsUtilsObjC",
dependencies: [
.product(name: "GoogleMaps", package: "ios-maps-sdk"),
],
publicHeadersPath: "include",
cSettings: [
.headerSearchPath("."),
],
linkerSettings: [
.linkedFramework("UIKit", .when(platforms: [.iOS])),
]
),
.target(
name: "GoogleMapsUtils",
dependencies: [
.target(name: "GoogleMapsUtilsObjC"),
.product(name: "GoogleMaps", package: "ios-maps-sdk"),
]
),
.target(
name: "GoogleMapsUtilsTestsHelper",
dependencies: [
.target(name: "GoogleMapsUtilsObjC"),
],
path: "Tests/GoogleMapsUtilsTestsHelper"
),
.testTarget(
name: "GoogleMapsUtilsObjCTests",
dependencies: [
"GoogleMapsUtilsObjC",
"GoogleMapsUtilsTestsHelper",
.product(name: "OCMock", package: "ocmock"),
],
path: "Tests/GoogleMapsUtilsObjCTests",
cSettings: [
.headerSearchPath(".")
]
),
.testTarget(
name: "GoogleMapsUtilsSwiftTests",
dependencies: [
"GoogleMapsUtils",
"GoogleMapsUtilsObjC",
"GoogleMapsUtilsTestsHelper",
.product(name: "GoogleMaps", package: "ios-maps-sdk"),
],
path: "Tests/GoogleMapsUtilsSwiftTests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/// TO-DO: Rename the class to `GMUWrappingDictionaryKey` once the linking is done and remove the objective c class.
/// Wraps an object that does not implement Hashable to be used as Dictionary keys.
///
import Foundation

final class GMUWrappingDictionaryKey1: NSObject, NSCopying {

// MARK: - Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ final class GMUClusterManager1: NSObject, GMSMapViewDelegate {
func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
/// Check if the delegate can handle cluster taps and if the marker represents a cluster.
if let delegate = delegate,
let cluster = marker.userData as? GMUCluster,
let cluster = marker.userData as? GMUCluster1,
delegate.clusterManager(self, didTapCluster: cluster) {
return true
}

/// Check if the delegate can handle cluster item taps and if the marker represents a cluster item.
if let delegate = delegate,
let clusterItem = marker.userData as? GMUClusterItem,
let clusterItem = marker.userData as? GMUClusterItem1,
delegate.clusterManager(self, didTapClusterItem: clusterItem) {
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ protocol GMUClusterManagerDelegate1: AnyObject {
/// - clusterManager: The cluster manager handling the clusters.
/// - cluster: The cluster that was tapped.
/// - Returns: `true` if the delegate handled the tap event, `false` to pass this event to other handlers.
func clusterManager(_ clusterManager: GMUClusterManager1, didTapCluster cluster: GMUCluster) -> Bool
func clusterManager(_ clusterManager: GMUClusterManager1, didTapCluster cluster: GMUCluster1) -> Bool

/// Called when the user taps on a cluster item marker.
/// - Parameters:
/// - clusterManager: The cluster manager handling the clusters.
/// - clusterItem: The cluster item that was tapped.
/// - Returns: `true` if the delegate handled the tap event, `false` to pass this event to other handlers.
func clusterManager(_ clusterManager: GMUClusterManager1, didTapClusterItem clusterItem: GMUClusterItem) -> Bool
func clusterManager(_ clusterManager: GMUClusterManager1, didTapClusterItem clusterItem: GMUClusterItem1) -> Bool
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
/// TO-DO: Rename the class to `GMUStaticCluster` once the linking is done and remove the objective c class.
/// A class representing a static cluster where its position is fixed upon initialization.
///
import CoreLocation

final class GMUStaticCluster1: GMUCluster1 {

// MARK: - Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
/// Whereas clusters with a size of 100 to 199 items will be placed in the 100+ bucket and have the '100+' icon shown.
/// This caches already generated icons for performance reasons.
///
import UIKit

final class GMUDefaultClusterIconGenerator1: GMUClusterIconGenerator1 {

// MARK: - Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import Foundation

enum GMUDefaultClusterIconGeneratorError: Error, LocalizedError {
case invalidArgumentException(String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/// TO-DO: Rename the class to `GMUClusterIconGenerator` once the linking is done and remove the objective c class.
/// Defines a contract for cluster icon generation.
///
import UIKit

protocol GMUClusterIconGenerator1 {

/// Generates an icon with the given size.
Expand Down
16 changes: 0 additions & 16 deletions Sources/GoogleMapsUtils/Exports.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
/// TO-DO: Rename the class to `GMUKMLParser` once the linking is done and remove the objective c class.
/// This extension provides the delegate(`XMLParserDelegate`) implementations, of the `GMUKMLParser` class.
///
import Foundation

extension GMUKMLParser1 {

// MARK: - `didStartElement`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
/// TO-DO: Rename the class to `GMUKMLParser` once the linking is done and remove the objective c class.
/// The class responsible for parsing KML documents, using the XMLParserDelegate protocol.
///
import UIKit
import CoreLocation
import GoogleMaps

final class GMUKMLParser1: NSObject, XMLParserDelegate {
// MARK: - Properties
/// The XML parser used to read the specified document.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

/// Instances of this class represent a Ground Overlay object.
/// TO-DO: Rename the class to `GMUGroundOverlay` once the linking is done and remove the objective c class.
import CoreLocation

struct GMUGroundOverlay1: GMUGeometry1 {
// MARK: - Properties
/// The type of the geometry.
Expand Down
6 changes: 5 additions & 1 deletion Sources/GoogleMapsUtils/Geometry/Models/GMULineString1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ import GoogleMaps

/// Instances of this class represent a LineString object.
/// TO-DO: Rename the class to `GMULineString` once the linking is done and remove the objective c class.
struct GMULineString1: GMUGeometry1 {
struct GMULineString1: GMUGeometry1, Equatable {
// MARK: - Properties
/// The type of the geometry.
var type: String = "LineString"
/// The path of the LineString.
private(set) var path: GMSPath

static func == (lhs: GMULineString1, rhs: GMULineString1) -> Bool {
return true
}
}

8 changes: 7 additions & 1 deletion Sources/GoogleMapsUtils/Geometry/Models/GMUPoint1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@

/// Instances of this class represent a GeoJSON Feature object.
/// TO-DO: Rename the class to `GMUPoint` once the linking is done and remove the objective c class.
struct GMUPoint1: GMUGeometry1 {
import CoreLocation

struct GMUPoint1: GMUGeometry1, Equatable {
// MARK: - Properties
/// The type of the geometry.
var type: String = "Point"
/// The 2D coordinate of the Point, containing a latitude and longitude.
private(set) var coordinate: CLLocationCoordinate2D

static func == (lhs: GMUPoint1, rhs: GMUPoint1) -> Bool {
return true
}
}

2 changes: 2 additions & 0 deletions Sources/GoogleMapsUtils/Geometry/Models/GMUStyle1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/// Instances of this class represent a geometry Style. It is used to define the
/// stylings of any number of GMUGeometry objects.
/// TO-DO: Rename the class to `GMUStyle` once the linking is done and remove the objective c class.
import UIKit

struct GMUStyle1: Equatable {
// MARK: - Properties
/// The unique identifier of the style
Expand Down
2 changes: 2 additions & 0 deletions Sources/GoogleMapsUtils/Heatmap/Gradient/GMUGradient1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/// Represents a mapping of intensity to color. Interpolates between a given set of intensities and
/// color values to produce a full mapping for the range [0, 1].
///
import UIKit

final class GMUGradient1 {

// MARK: - Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import Foundation

enum GMUGradientError: Error, LocalizedError {
case invalidArgumentException(String)
Expand Down
14 changes: 7 additions & 7 deletions Sources/GoogleMapsUtils/Heatmap/HeatmapInterpolationPoints.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import GoogleMaps
public class HeatmapInterpolationPoints: NSObject {

/// The input data set
private var data = [GMUWeightedLatLng]()
private var data = [GMUWeightedLatLng1]()

/// The list of interpolated heat map points with weight
private var heatmapPoints = [GMUWeightedLatLng]()
private var heatmapPoints = [GMUWeightedLatLng1]()

/// Since IDW takes into account the distance an interpolated point is from the given points, it naturally begs the question: how
/// much should distance affect the interpolated value? If we don't want distance to affect interpolated values at all (which is not a
Expand Down Expand Up @@ -58,14 +58,14 @@ public class HeatmapInterpolationPoints: NSObject {
/// Adds a list of GMUWeightedLatLng objects to the input data set
///
/// - Parameter latlngs: The list of GMUWeightedLatLng objects to add.
public func addWeightedLatLngs(latlngs: [GMUWeightedLatLng]) {
func addWeightedLatLngs(latlngs: [GMUWeightedLatLng1]) {
data.append(contentsOf: latlngs)
}

/// Adds a single GMUWeightedLatLng object to the input data set
///
/// - Parameter latlngs: The list of GMUWeightedLatLng objects to add.
public func addWeightedLatLng(latlng: GMUWeightedLatLng) {
func addWeightedLatLng(latlng: GMUWeightedLatLng1) {
data.append(latlng)
}

Expand Down Expand Up @@ -307,10 +307,10 @@ public class HeatmapInterpolationPoints: NSObject {
/// - granularity: How coarse the search range is WRT to lat/long and must be larger than 0 but smaller than 1 (as
/// granularity approaches 0, the runtime will increase and as granularity approaches 1, the heat map becomes quite sparse); a
/// value of 0.1 is a good sweet spot.
public func generatePoints(
func generatePoints(
influence: HeatmapInterpolationInfluence,
granularity: Double = 0.1
) throws -> [GMUWeightedLatLng] {
) throws -> [GMUWeightedLatLng1] {

// As documented above, we will throw an exception here if the n value is not in the
// appropriate range
Expand Down Expand Up @@ -369,7 +369,7 @@ public class HeatmapInterpolationPoints: NSObject {
}

// Set the intensity based on IDW
let coords = GMUWeightedLatLng(
let coords = GMUWeightedLatLng1(
coordinate: CLLocationCoordinate2DMake(
Double(i) * granularity,
Double(j) * granularity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

/// TO-DO: Rename the class to `GMUHeatmapTileCreationData` once the linking is done and remove the objective c class.
/// Holder for data that must be consistent when accessed from tile creation threads.
import UIKit

struct GMUHeatmapTileCreationData1 {

/// Public variables for the heatmap tile creation data.
Expand Down
16 changes: 0 additions & 16 deletions Sources/GoogleMapsUtilsObjC/include/GMSMarker+GMUClusteritem.h

This file was deleted.

13 changes: 0 additions & 13 deletions Sources/GoogleMapsUtilsObjC/include/GMSMarker+GMUClusteritem.m

This file was deleted.

Loading