Skip to content
Permalink
a949599b37
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
44 lines (37 sloc) 1.34 KB
//
// BalanceInterfaceController.swift
// SynchronyFinancial WatchKit Extension
//
// Created by Jonathan Duarte on 2/18/19.
// Copyright © 2019 Alan Maynard. All rights reserved.
//
import WatchKit
import Foundation
class UtilizationInterfaceController: WKInterfaceController {
var didAnimate: Bool = false
var util: Double = 0
var score: Int = 0
@IBOutlet weak var image3: WKInterfaceImage!
override func awake(withContext context: Any?) {
super.awake(withContext: context)
guard let util = context as? Int else {
NSLog("Error getting Utilization metric.")
return
}
// resize according to screen size so we can display button below
image3.setHeight(contentFrame.height / 2)
image3.setWidth(contentFrame.height / 2)
image3.setHorizontalAlignment(.center)
score = util
}
override func didAppear() {
if !didAnimate {
image3.setImageNamed("scores")
image3.startAnimatingWithImages(in: NSRange(location: 1, length: score), duration: 1.5, repeatCount: 1)
didAnimate = true
}
}
@IBAction func showDetails() {
presentAlert(withTitle: "Utilization Details", message: Defaults.UTIL, preferredStyle: .alert, actions: [WKAlertAction(title: "Done", style: .default, handler: {})])
}
}