Skip to content
Permalink
10e6442e7c
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
48 lines (37 sloc) 1.35 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: Int?
@IBOutlet weak var image3: WKInterfaceImage!
override func awake(withContext context: Any?) {
super.awake(withContext: context)
// get plist data to generate utilization metric
var plistValues = PlistUtil.readPlist(for: .balance)
let balance = plistValues[0][0]
let credit = plistValues[0][1] > 0 ? plistValues[0][1] : 1
util = Int(round((Double(balance)/Double(credit)) * 100))
}
override func didAppear() {
if !didAnimate {
image3.setImageNamed("scores")
image3.startAnimatingWithImages(in: NSRange(location: 1, length: util ?? 0), duration: 1.5, repeatCount: 1)
didAnimate = true
}
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}
}