Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SWF-10 Fix typo and set up format strings for labels
  • Loading branch information
ahm11003 committed Mar 7, 2019
1 parent 472f648 commit 424e7eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Expand Up @@ -45,10 +45,13 @@ class AccountDetailsInterfaceController: WKInterfaceController {
return
}

accountNameLabel.setText(acct.accountNumber)
balanceLabel.setText("Balance: $\(acct.balance)")
availableFundsLabel.setText("Available: $\(acct.limit - acct.balance)")
let balanceFormatted = String(format: "%.2f", acct.balance)
let availableFormatted = String(format: "%.2f", acct.limit - acct.balance)
let date = DateFormatter.localizedString(from: acct.paymentDueDate, dateStyle: .medium, timeStyle: .none)

accountNameLabel.setText(acct.accountNumber)
balanceLabel.setText("Balance: $\(balanceFormatted)")
availableFundsLabel.setText("Available: $\(availableFormatted)")
nextPaymentDueLabel.setText(date)
}
}
Expand Up @@ -17,7 +17,7 @@ class AccountTableInterfaceController: WKInterfaceController {
override func awake(withContext context: Any?) {
super.awake(withContext: context)

populateDemoDate()
populateDemoData()
configureRows()
}

Expand All @@ -31,6 +31,7 @@ class AccountTableInterfaceController: WKInterfaceController {
super.didDeactivate()
}

//swiftlint:disable:next line_length
override func contextForSegue(withIdentifier segueIdentifier: String, in table: WKInterfaceTable, rowIndex: Int) -> Any? {
if segueIdentifier == "showAccountDetails" {
acctDict.updateValue(accounts[rowIndex], forKey: "acct")
Expand All @@ -49,7 +50,7 @@ class AccountTableInterfaceController: WKInterfaceController {
}
}

private func populateDemoDate() {
private func populateDemoData() {
//swiftlint:disable line_length
accounts.append(Account(accountNumber: "TD Bank", limit: 500.00, transactions: [], paymentDueDate: Date(), cycleEndDate: Date()))
accounts.append(Account(accountNumber: "Care Credit", limit: 10000.00, transactions: [], paymentDueDate: Date(), cycleEndDate: Date()))
Expand Down

0 comments on commit 424e7eb

Please sign in to comment.