Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SWF-21 pass fetched accounts to AccountTVIC
- removed now unused objects
- set up `acctDict` to pass any initially fetched accounts to `AccountsTableViewInterfaceController`
- we check upon awake if we have accounts, and then configure table accordingly
  • Loading branch information
ahm11003 committed Mar 28, 2019
1 parent 8405351 commit c80231e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Expand Up @@ -17,6 +17,10 @@ class AccountTableInterfaceController: WKInterfaceController {
override func awake(withContext context: Any?) {
super.awake(withContext: context)

if let context = context as? [String: [Account]], let accts = context["accts"] {
accounts = accts
}

configureRows()
}

Expand Down
Expand Up @@ -15,7 +15,8 @@ class MainMenuInterfaceController: WKInterfaceController {
@IBOutlet weak var accountsButton: WKInterfaceButton!
@IBOutlet weak var wellnessButton: WKInterfaceButton!

var accounts: [Account] = []
var acctDict: [String: [Account]] = [:]

override func awake(withContext context: Any?) {
super.awake(withContext: context)

Expand All @@ -29,7 +30,7 @@ class MainMenuInterfaceController: WKInterfaceController {
return
}

self.accounts = accounts
self.acctDict["accts"] = accounts
}
case false:
NSLog("Login Error: %s", error?.localizedDescription ?? "Unknown Error")
Expand All @@ -52,8 +53,8 @@ class MainMenuInterfaceController: WKInterfaceController {

override func contextForSegue(withIdentifier segueIdentifier: String) -> Any? {
if segueIdentifier == "toAccounts" {
// we will probably want to do some setup prior to presenting Accounts
print(accounts.count)
// pass fetched accounts to AccountsTableViewInterfaceController
return acctDict
} else if segueIdentifier == "toWellness" {
// we will probably want to do some setup prior to presenting Wellness
}
Expand Down

0 comments on commit c80231e

Please sign in to comment.