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/MainMenuInterfaceController.swift
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
55 lines (45 sloc)
1.74 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
// | |
// MainMenuInterfaceController.swift | |
// SynchronyFinancial WatchKit Extension | |
// | |
// Created by Alan Maynard on 11/21/18. | |
// Copyright © 2018 Alan Maynard. All rights reserved. | |
// | |
import WatchKit | |
import Foundation | |
import Alamofire | |
import SwiftyJSON | |
class MainMenuInterfaceController: WKInterfaceController { | |
@IBOutlet weak var accountsButton: WKInterfaceButton! | |
@IBOutlet weak var wellnessButton: WKInterfaceButton! | |
@IBOutlet var activityIndicator: WKInterfaceImage! | |
var acctDict: [String: [Account]] = [:] | |
override func awake(withContext context: Any?) { | |
super.awake(withContext: context) | |
guard let initial = context as? [String: [Account]], let accts = initial["accts"] else { | |
accountsButton.setHidden(true) | |
wellnessButton.setHidden(true) | |
activityIndicator.configureForActivityIndicator() | |
NSLog("Error getting context from WKExtensionDelegate, showing activity indicator") | |
return | |
} | |
acctDict.updateValue(accts, forKey: "accts") | |
} | |
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() | |
} | |
override func contextForSegue(withIdentifier segueIdentifier: String) -> Any? { | |
if segueIdentifier == "toAccounts" { | |
// pass fetched accounts to AccountsTableViewInterfaceController | |
return acctDict | |
} else if segueIdentifier == "toWellness" { | |
// we will probably want to do some setup prior to presenting Wellness | |
} | |
return nil | |
} | |
} |