Permalink
Cannot retrieve contributors at this time
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?
SynchronyFinancialWatchApp/SynchronyFinancial/SynchronyFinancial WatchKit Extension/UtilizationfaceController.swift
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44 lines (37 sloc)
1.34 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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: {})]) | |
} | |
} |