mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-02 18:33:54 +00:00
32 lines
832 B
Swift
32 lines
832 B
Swift
//
|
|
// SpeedViewController.swift
|
|
// SAPTracker
|
|
//
|
|
// Created by computing on 09/12/14.
|
|
// Copyright (c) 2014 com.sap.sailing. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
class SpeedViewController: UIViewController {
|
|
|
|
let knPerMs = 1.94552529182879
|
|
|
|
@IBOutlet weak var speedLabel: UILabel!
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
NSNotificationCenter.defaultCenter().addObserver(self, selector:"newLocation:", name:LocationManager.NotificationType.newLocation, object: nil)
|
|
}
|
|
|
|
deinit {
|
|
NSNotificationCenter.defaultCenter().removeObserver(self)
|
|
}
|
|
|
|
func newLocation(notification: NSNotification) {
|
|
let ms = notification.userInfo!["speed"] as Double
|
|
let kn = ms * knPerMs
|
|
speedLabel.text = String(format: "%0.1f kn", kn)
|
|
}
|
|
|
|
} |