Skip to content
Permalink
cc16cdfc32
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
46 lines (39 sloc) 1.58 KB
//
// TransactionDetailsInterfaceController.swift
// SynchronyFinancial WatchKit Extension
//
// Created by Alan Maynard on 4/2/19.
// Copyright © 2019 Alan Maynard. All rights reserved.
//
import WatchKit
import Foundation
class TransactionDetailsInterfaceController: WKInterfaceController {
@IBOutlet var transactionName: WKInterfaceLabel!
@IBOutlet var dateLabel: WKInterfaceLabel!
@IBOutlet var amountLabel: WKInterfaceLabel!
@IBOutlet var cancelButton: WKInterfaceButton!
override func awake(withContext context: Any?) {
super.awake(withContext: context)
guard let data = context as? [String: Any],
let transaction = data["transaction"] as? Transaction,
let merchant = data["merchant"] as? String,
let date = data["date"] as? Date,
let amount = data["amount"] as? Double else {
NSLog("Error receiving context in TransactionDetails.")
return
}
setTitle("Dismiss")
transactionName.setText(merchant)
dateLabel.setText("Date: \(DateFormatter.localizedString(from: date, dateStyle: .short, timeStyle: .none))")
amountLabel.setText(String(format: "Amount: $%.2f", amount))
cancelButton.setHidden(!transaction.isModifiable)
}
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()
}
}