Skip to content

Commit 214e15f

Browse files
committed
remove lint warnings in GPXMapView
1 parent 130b28c commit 214e15f

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

Diff for: OpenGpxTracker/GPXMapView.swift

+19-22
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,21 @@ class GPXMapView: MKMapView {
4242
var currentSegmentOverlay: MKPolyline
4343

4444
///
45-
var extent: GPXExtentCoordinates = GPXExtentCoordinates() //extent of the GPX points and tracks
45+
var extent: GPXExtentCoordinates = GPXExtentCoordinates() // Extent of the GPX points and tracks
4646

47-
///position of the compass in the map
48-
///Example:
47+
/// Position of the compass in the map
48+
/// Example:
4949
/// map.compassRect = CGRect(x: map.frame.width/2 - 18, y: 70, width: 36, height: 36)
5050
var compassRect: CGRect
5151

5252
/// Is the map using local image cache??
53-
var useCache: Bool = true { //use tile overlay cache (
53+
var useCache: Bool = true { // Use tile overlay cache (
5454
didSet {
5555
if tileServerOverlay is CachedTileOverlay {
5656
print("GPXMapView:: setting useCache \(useCache)")
5757
// swiftlint:disable force_cast
5858
(tileServerOverlay as! CachedTileOverlay).useCache = useCache
59+
// swiftlint:enable force_cast
5960
}
6061
}
6162
}
@@ -72,13 +73,13 @@ class GPXMapView: MKMapView {
7273
updateMapInformation(newValue)
7374
// remove current overlay
7475
if tileServer != .apple {
75-
//to see apple maps we need to remove the overlay added by map cache.
76+
// To see apple maps we need to remove the overlay added by map cache.
7677
removeOverlay(tileServerOverlay)
7778
}
7879

79-
//add new overlay to map if not using Apple Maps
80+
// Add new overlay to map if not using Apple Maps
8081
if newValue != .apple && newValue != .appleSatellite {
81-
//Update cacheConfig
82+
// Update cacheConfig
8283
var config = MapCacheConfig(withUrlTemplate: newValue.templateUrl)
8384
config.subdomains = newValue.subdomains
8485
config.tileSize = CGSize(width: newValue.tileSize, height: newValue.tileSize)
@@ -93,8 +94,7 @@ class GPXMapView: MKMapView {
9394
// we need to keep a reference to remove it, in case we return back to Apple Maps.
9495
//
9596
tileServerOverlay = useCache(cache, canReplaceMapContent: newValue.canReplaceMapContent)
96-
}
97-
else {
97+
} else {
9898
self.mapType = (newValue == .apple) ? .standard : .satellite
9999
}
100100
}
@@ -130,7 +130,7 @@ class GPXMapView: MKMapView {
130130
/// Initializes the map with an empty currentSegmentOverlay.
131131
///
132132
required init?(coder aDecoder: NSCoder) {
133-
var tmpCoords: [CLLocationCoordinate2D] = [] //init with empty
133+
var tmpCoords: [CLLocationCoordinate2D] = [] // Init with empty
134134
currentSegmentOverlay = MKPolyline(coordinates: &tmpCoords, count: 0)
135135
compassRect = CGRect.init(x: 0, y: 0, width: 36, height: 36)
136136
super.init(coder: aDecoder)
@@ -257,8 +257,8 @@ class GPXMapView: MKMapView {
257257
let pt = GPXTrackPoint(location: location)
258258
coreDataHelper.add(toCoreData: pt, withTrackSegmentID: session.trackSegments.count)
259259
session.addPointToCurrentTrackSegmentAtLocation(location)
260-
//redrawCurrent track segment overlay
261-
//First remove last overlay, then re-add the overlay updated with the new point
260+
// RedrawCurrent track segment overlay
261+
// First remove last overlay, then re-add the overlay updated with the new point
262262
removeOverlay(currentSegmentOverlay)
263263
currentSegmentOverlay = session.currentSegment.overlay
264264

@@ -283,7 +283,7 @@ class GPXMapView: MKMapView {
283283
/// Finishes current segment.
284284
///
285285
func finishCurrentSegment() {
286-
startNewTrackSegment() //basically, we need to append the segment to the list of segments
286+
startNewTrackSegment() // Basically, we need to append the segment to the list of segments
287287
}
288288

289289
///
@@ -295,8 +295,8 @@ class GPXMapView: MKMapView {
295295
removeAnnotations(annotations)
296296
extent = GPXExtentCoordinates()
297297

298-
//add tile server overlay
299-
//by removing all overlays, tile server overlay is also removed. We need to add it back
298+
// Add tile server overlay
299+
// by removing all overlays, tile server overlay is also removed. We need to add it back
300300
if tileServer != .apple {
301301
addOverlayOnBottom(tileServerOverlay)
302302
}
@@ -344,10 +344,9 @@ class GPXMapView: MKMapView {
344344
session.totalTrackedDistance += oneTrack.length
345345
for segment in oneTrack.segments {
346346
let overlay = segment.overlay
347-
//addOverlay(overlay)
348347
addOverlayOnTop(overlay)
349348
let segmentTrackpoints = segment.points
350-
//add point to map extent
349+
// Add point to map extent
351350
for waypoint in segmentTrackpoints {
352351
extent.extendAreaToIncludeLocation(waypoint.coordinate)
353352
}
@@ -366,26 +365,24 @@ class GPXMapView: MKMapView {
366365
session.totalTrackedDistance += oneTrack.length
367366
for segment in oneTrack.segments {
368367
let overlay = segment.overlay
369-
//addOverlay(overlay)
370368
addOverlayOnTop(overlay)
371369

372370
let segmentTrackpoints = segment.points
373-
//add point to map extent
371+
// Add point to map extent
374372
for waypoint in segmentTrackpoints {
375373
extent.extendAreaToIncludeLocation(waypoint.coordinate)
376374
}
377375
}
378376
}
379377

380-
// for last session track segment
378+
// For last session track segment
381379
for trackSegment in session.trackSegments {
382380

383381
let overlay = trackSegment.overlay
384-
//addOverlay(overlay)
385382
addOverlayOnTop(overlay)
386383

387384
let segmentTrackpoints = trackSegment.points
388-
//add point to map extent
385+
// Add point to map extent
389386
for waypoint in segmentTrackpoints {
390387
extent.extendAreaToIncludeLocation(waypoint.coordinate)
391388
}

0 commit comments

Comments
 (0)