Skip to content

Commit 2a12635

Browse files
committed
Merge branch 'release/5.0.3'
2 parents bcbf8d1 + 6229013 commit 2a12635

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

Sources/SwiftLocation/Request/Requests/GPSLocation/GPSLocationOptions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ public class GPSLocationOptions: CustomStringConvertible, Codable {
118118

119119
public var description: String {
120120
switch self {
121-
case .immediate(let t): return "immediate \(t)s"
122-
case .delayed(let t): return "delayed \(t)s"
121+
case .immediate(let t): return "immediate \(abs(t))s"
122+
case .delayed(let t): return "delayed \(abs(t))s"
123123
}
124124
}
125125

Sources/SwiftLocation/Request/Requests/GPSLocation/GPSLocationRequest.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ public class GPSLocationRequest: RequestProtocol, Codable {
141141
}
142142

143143
if let previousLocation = lastLocation {
144+
// We have already received a previous valid location so we'll
145+
// also check for distance and interval if required and eventually dispatch value.
144146
if options.minDistance > kCLDistanceFilterNone,
145147
previousLocation.distance(from: data) > options.minDistance {
146148
return .notMinDistance // minimum distance since last location is not respected.
@@ -152,6 +154,9 @@ public class GPSLocationRequest: RequestProtocol, Codable {
152154
}
153155
}
154156

157+
// Store previous value because it was validated.
158+
lastLocation = data
159+
155160
return nil
156161
}
157162

SwiftLocation.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "SwiftLocation"
3-
s.version = "5.0.2"
3+
s.version = "5.0.3"
44
s.summary = "Location Manager Made Easy"
55
s.description = <<-DESC
66
Efficient location tracking for iOS with support for oneshot/continuous/background tracking, reverse geocoding, autocomplete, geofencing, beacon monitoring & broadcasting

SwiftLocationPlayground/SwiftLocationPlayground/View Controllers/Features/Location by GPS/GPSController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class GPSController: UIViewController, UITableViewDelegate, UITableViewDataSourc
9494
case .subscription:
9595
cell.valueLabel.text = serviceOptions.subscription.description
9696
case .timeoutInterval:
97-
cell.valueLabel.text = serviceOptions.minTimeInterval?.format() ?? NOT_SET
97+
cell.valueLabel.text = serviceOptions.timeout?.description ?? NOT_SET
9898
case .precise:
9999
cell.valueLabel.text = serviceOptions.precise?.description ?? USER_SET
100100
}

SwiftLocationPlayground/SwiftLocationPlayground/View Controllers/Requests List/RequestListController.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,18 @@ class RequestListController: UIViewController, UITableViewDelegate, UITableViewD
162162
}
163163
}
164164

165-
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
165+
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
166166
guard indexPath.section > 0 else {
167167
return nil
168168
}
169169

170-
return [
171-
UITableViewRowAction(style: .destructive, title: "Stop Monitor", handler: { [weak self] (_, indexPath) in
172-
DispatchQueue.main.async {
173-
self?.cancelRequestAtIndexPath(indexPath)
174-
}
175-
})
176-
]
170+
let action = UIContextualAction(style: .destructive, title: "Stop Monitor") { [weak self] (action, view, completionHandler) in
171+
self?.cancelRequestAtIndexPath(indexPath)
172+
173+
completionHandler(true)
174+
}
175+
176+
return UISwipeActionsConfiguration(actions: [action])
177177
}
178178

179179
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

0 commit comments

Comments
 (0)