37 lines
990 B
Swift
37 lines
990 B
Swift
//
|
|
// EQNDebugHelper.swift
|
|
// Earthquake Network
|
|
//
|
|
// Created by Andrea Busi on 14/07/23.
|
|
// Copyright © 2023 Earthquake Network. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
|
|
@objc
|
|
class EQNDebugHelper: NSObject {
|
|
|
|
@objc
|
|
static let shared = EQNDebugHelper()
|
|
|
|
private var timers: [String: Timer] = [:]
|
|
|
|
// MARK: - Public
|
|
|
|
@objc
|
|
func printPositions(
|
|
interval: TimeInterval = 2.0,
|
|
repeats: Bool = true
|
|
) {
|
|
let timer = Timer.scheduledTimer(withTimeInterval: interval, repeats: true) { timer in
|
|
let current = EQNUserData.shared.lastLocation?.coordinate
|
|
print("[EQNDebugHelper] Current | lat: \(current?.latitude ?? 0) - lon: \(current?.longitude ?? 0)")
|
|
|
|
let saved = EQNUser.default().lastPosition?.coordinate
|
|
print("[EQNDebugHelper] Saved | lat: \(saved?.latitude ?? 0) - lon: \(saved?.longitude ?? 0)")
|
|
}
|
|
timers["positions"] = timer
|
|
}
|
|
}
|