Skip to content
Permalink
433ebacb56
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
41 lines (36 sloc) 1.35 KB
//
// AvgUtilizationInterfaceController.swift
// SynchronyFinancial WatchKit Extension
//
// Created by Alan Maynard on 4/23/19.
// Copyright © 2019 Alan Maynard. All rights reserved.
//
import WatchKit
import Foundation
class AvgUtilizationInterfaceController: WKInterfaceController {
@IBOutlet var avgUtilizationChart: WKInterfaceImage!
var didAnimate: Bool = false
var average: Double = 0.0
override func awake(withContext context: Any?) {
super.awake(withContext: context)
guard let avg = context as? Double else {
NSLog("Error getting average utilization.")
return
}
average = avg
}
override func didAppear() {
if !didAnimate {
avgUtilizationChart.setImageNamed("scores")
if average < 1.0 {
avgUtilizationChart.startAnimatingWithImages(in: NSRange(location: 0, length: 1), duration: 1, repeatCount: 1)
} else {
avgUtilizationChart.startAnimatingWithImages(in: NSRange(location: 1, length: Int(average)), duration: 1, repeatCount: 1)
}
didAnimate = true
}
}
@IBAction func showDetails() {
presentAlert(withTitle: "Average Utilization", message: Defaults.AVG_UTIL, preferredStyle: .alert, actions: [WKAlertAction(title: "Done", style: .default, handler: {})])
}
}