-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
74 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// ContentView.swift | ||
// Xpendi (iOS) | ||
// | ||
// Created by Ananya George on 9/30/21. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ContentView: View { | ||
var balanceSheet: [Balance] = [Balance(amount: 567.8, title: "paid for popcorn", action: .withdrawal)] | ||
var body: some View { | ||
List { | ||
ForEach(balanceSheet) { | ||
Text("\($0.title ?? "")") | ||
.foregroundColor($0.action.color) | ||
} | ||
} | ||
.toolbar { | ||
#if os(iOS) | ||
EditButton() | ||
#endif | ||
|
||
Button(action: addItem) { | ||
Label("Add Item", systemImage: "plus") | ||
} | ||
} | ||
} | ||
private func addItem() { | ||
} | ||
} | ||
|
||
struct ContentView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ContentView() | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,37 @@ | ||
// | ||
// Balance.swift | ||
// Xpendi (iOS) | ||
// | ||
// Created by Ananya George on 9/30/21. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
class Balance: Identifiable { | ||
var amount: Double | ||
var title: String | ||
var action: Action | ||
var date: Date | ||
|
||
init(amount: Double, title: String, action: Action) { | ||
self.amount = amount | ||
self.title = title | ||
self.action = action | ||
self.date = Date() | ||
} | ||
} | ||
|
||
enum Action { | ||
case withdrawal | ||
case deposit | ||
|
||
var color: Color { | ||
switch self { | ||
case .withdrawal: | ||
return .red | ||
case .deposit: | ||
return .green | ||
} | ||
} | ||
} |