Skip to content
Permalink
4c76ad5261
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
45 lines (36 sloc) 1.33 KB
//
// AccountTableInterfaceController.swift
// SynchronyFinancial WatchKit Extension
//
// Created by Monday on 2019/02/13.
// Copyright © 2019 Alan Maynard. All rights reserved.
//
import WatchKit
import Foundation
class AccountTableInterfaceController: WKInterfaceController {
var accounts: [Account] = []
var transactionDict: [String: [Transaction]] = [:]
@IBOutlet var titleLabel: WKInterfaceLabel!
@IBOutlet weak var accountTable: WKInterfaceTable!
override func awake(withContext context: Any?) {
super.awake(withContext: context)
guard let data = context as? [Account] else {
NSLog("Error getting accounts table context")
return
}
accounts = data
configureRows()
}
override func table(_ table: WKInterfaceTable, didSelectRowAt rowIndex: Int) {
pushController(withName: "AccountDetails", context: accounts[rowIndex])
}
private func configureRows() {
accountTable.setNumberOfRows(accounts.count, withRowType: "account")
for index in 0..<accountTable.numberOfRows {
if let row = accountTable.rowController(at: index) as? AccountCell {
row.accountName.setText(accounts[index].accountName)
row.last4Label.setText("(...\(accounts[index].last4))")
}
}
}
}