-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from rrk12005/SWE-23-transaction-details
Swe 23 transaction details
- Loading branch information
Showing
4 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
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
46 changes: 46 additions & 0 deletions
46
...nancial/SynchronyFinancial WatchKit Extension/TransactionDetailsInterfaceController.swift
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// 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() | ||
} | ||
|
||
} |
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
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