Skip to content

Commit

Permalink
iOS 16 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthetechie committed Nov 11, 2023
1 parent ba9ac84 commit dc33d3b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if useLocalFramework {
let package = Package(
name: "FerrostarCore",
platforms: [
.iOS(.v17),
.iOS(.v16),
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ and it leverages macros.

### iOS

After some discussion, we plan to start iOS support at version 16.
We will roll back the use of features requiring iOS 17 over the coming weeks.
Our general policy will be to support the current and previous major version.
We plan to start iOS support at version 16.
Our general policy will be to support the current and at least the previous major version,
extending to two major versions if possible.

### Android

Expand Down
1 change: 0 additions & 1 deletion apple/Sources/FerrostarCore/FerrostarCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public protocol FerrostarCoreDelegate: AnyObject {
/// The particulars will vary by app; do what makes the most sense for your user experience.
///
/// Finally, with a route selected, call ``startNavigation(route:)`` to start a session.
@Observable
@objc public class FerrostarCore: NSObject {
/// The delegate which will receive Ferrostar core events.
public weak var delegate: FerrostarCoreDelegate?
Expand Down
14 changes: 6 additions & 8 deletions apple/Sources/FerrostarCore/Location.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public protocol LocationManagingDelegate: AnyObject {
}

// TODO: Permissions are currently NOT handled and they should be!!!
@Observable
public class LiveLocationProvider: NSObject {
public class LiveLocationProvider: NSObject, ObservableObject {
public var delegate: LocationManagingDelegate?
public private(set) var authorizationStatus: CLAuthorizationStatus

Expand All @@ -44,9 +43,9 @@ public class LiveLocationProvider: NSObject {
locationManager.activityType = activityType
}

public private(set) var lastLocation: CLLocation?
@Published public private(set) var lastLocation: CLLocation?

public private(set) var lastHeading: CLHeading?
@Published public private(set) var lastHeading: CLHeading?
}

extension LiveLocationProvider: LocationProviding {
Expand Down Expand Up @@ -90,16 +89,15 @@ extension LiveLocationProvider: CLLocationManagerDelegate {
/// Location provider for testing without relying on simulator location spoofing.
///
/// This allows for more granular unit tests.
@Observable
public class SimulatedLocationProvider: LocationProviding {
public class SimulatedLocationProvider: LocationProviding, ObservableObject {
public var delegate: LocationManagingDelegate?
public var lastLocation: CLLocation? {
@Published public var lastLocation: CLLocation? {
didSet {
notifyDelegateOfLocation()
}
}

public var lastHeading: CLHeading? {
@Published public var lastHeading: CLHeading? {
didSet {
notifyDelegateOfHeading()
}
Expand Down
21 changes: 10 additions & 11 deletions apple/Sources/FerrostarCore/ObservableState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ import UniFFI
///
/// While the core generally does not include UI, this is purely at the model layer and should be implemented
/// the same for all frontends.
@Observable
public final class FerrostarObservableState {
public internal(set) var snappedLocation: CLLocation
public internal(set) var heading: CLHeading?
public internal(set) var courseOverGround: CLLocationDirection?
public internal(set) var fullRouteShape: [CLLocationCoordinate2D]
public internal(set) var remainingWaypoints: [CLLocationCoordinate2D]
public internal(set) var currentStep: UniFFI.RouteStep
public internal(set) var visualInstructions: UniFFI.VisualInstructions?
public internal(set) var spokenInstruction: UniFFI.SpokenInstruction?
public internal(set) var distanceToNextManeuver: CLLocationDistance?
public final class FerrostarObservableState: ObservableObject {
@Published public internal(set) var snappedLocation: CLLocation
@Published public internal(set) var heading: CLHeading?
@Published public internal(set) var courseOverGround: CLLocationDirection?
@Published public internal(set) var fullRouteShape: [CLLocationCoordinate2D]
@Published public internal(set) var remainingWaypoints: [CLLocationCoordinate2D]
@Published public internal(set) var currentStep: UniFFI.RouteStep
@Published public internal(set) var visualInstructions: UniFFI.VisualInstructions?
@Published public internal(set) var spokenInstruction: UniFFI.SpokenInstruction?
@Published public internal(set) var distanceToNextManeuver: CLLocationDistance?

init(snappedLocation: CLLocation, heading: CLHeading? = nil, fullRoute: [CLLocationCoordinate2D], steps: [RouteStep]) {
self.snappedLocation = snappedLocation
Expand Down
2 changes: 1 addition & 1 deletion apple/Sources/FerrostarMapLibreUI/BannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct BannerView: View {
}
.frame(maxWidth: .infinity)
.padding(.all, 8)
.background(Color.black.opacity(0.7).clipShape(.buttonBorder, style: FillStyle()))
.background(Color.black.opacity(0.7).clipShape(.rect(cornerRadius: 10), style: FillStyle()))
.padding(.horizontal, 16)
}
}
Expand Down
2 changes: 1 addition & 1 deletion apple/Sources/FerrostarMapLibreUI/NavigationMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public struct NavigationMapView: View {
let darkStyleURL: URL
// TODO: Configurable camera and user "puck" rotation modes

var navigationState: FerrostarObservableState
@ObservedObject var navigationState: FerrostarObservableState

@State private var camera: MapView.Camera

Expand Down

0 comments on commit dc33d3b

Please sign in to comment.