Externe Funktion mit WatchKit aufrufen und MenuItem erzwingen

Ich muss ein WatchKit Force-Touch implementierenMenuItem ein @ anrufsaveWorkout() -Methode, die sich in einer separaten Klasse befindet, die keine Unterklasse von @ hWKInterfaceController.

Ich weiß, dass jede Klasse mindestens einen bestimmten Initialisierer benötigt. Ich vermute, das ist der Schlüssel?

Btw, mein "saveSession () erreicht "print statement loggt sich in der Konsole ein, wenn ich die sim verwende, aber nicht, wenn ich ein Gerät verwende. Alle anderen print statements loggen sich in der Konsole ein, auch wenn ich das Gerät verwende. Ein bisschen seltsam.

Meine Initialisierungsversuche werfen verschiedene Fehler auf, wie zum Beispiel:

1. schwerwiegender Fehler: Verwendung des nicht implementierten Initialisierers 'init ()' für die Klasse 'DashboardController'

2. Fehlendes Argument für Parameter 'context' in Aufruf

Dashboard.swift

class DashboardController: WKInterfaceController {

@IBOutlet var timerLabel: WKInterfaceTimer!
@IBOutlet weak var milesLabel: WKInterfaceLabel!

// var wSM: WorkoutSessionManager

//init(wSM: WorkoutSessionManager) {
//  self.wSM = wSM
//  super.init()
//  }


override func awakeWithContext(context: AnyObject?) {
    super.awakeWithContext(context)

    addMenuItemWithItemIcon(.Accept, title: "Save", action: #selector(DashboardController.saveSession))
}

override func willActivate() {
    super.willActivate()
    print("Dashboard controller reached")
}

func saveSession() {
    //wSM.saveWorkout()
    print("saveSession() reached")    
    }

WorkoutSessionManager.swift

class WorkoutSessionContext {

let healthStore: HKHealthStore
let activityType: HKWorkoutActivityType
let locationType: HKWorkoutSessionLocationType

init(healthStore: HKHealthStore, activityType: HKWorkoutActivityType = .Other, locationType: HKWorkoutSessionLocationType = .Unknown) {

    self.healthStore = healthStore
    self.activityType = activityType
    self.locationType = locationType
}
}

protocol WorkoutSessionManagerDelegate: class {
// ... protocol methods
}

class WorkoutSessionManager: NSObject, HKWorkoutSessionDelegate {

let healthStore: HKHealthStore
let workoutSession: HKWorkoutSession

init(context: WorkoutSessionContext) {
    self.healthStore = context.healthStore
    self.workoutSession = HKWorkoutSession(activityType: context.activityType, locationType: context.locationType)
    self.currentActiveEnergyQuantity = HKQuantity(unit: self.energyUnit, doubleValue: 0.0)
    self.currentDistanceQuantity = HKQuantity(unit: self.distanceUnit, doubleValue: 0.0)

    super.init()

    self.workoutSession.delegate = self
}

func saveWorkout() {
    guard let startDate = self.workoutStartDate, endDate = self.workoutEndDate else {return}

// ...code...