Skip to content

Commit

Permalink
SUBMITTING SOON
Browse files Browse the repository at this point in the history
  • Loading branch information
granwyntan committed Dec 21, 2020
1 parent d2c3073 commit d3e2ba8
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 48 deletions.
Binary file not shown.
9 changes: 5 additions & 4 deletions ฿u₫g€+/฿u₫g€+/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -1779,11 +1779,11 @@
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Uow-25-bR3">
<rect key="frame" x="0.0" y="0.0" width="380" height="82"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="Rlm-f2-gou">
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="Rlm-f2-gou">
<rect key="frame" x="0.0" y="0.0" width="19.666666666666668" height="82"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="toe-6J-Dss">
<rect key="frame" x="0.0" y="0.0" width="19.666666666666668" height="22"/>
<rect key="frame" x="0.0" y="0.0" width="15" height="22"/>
<state key="normal" image="restart" catalog="system"/>
<connections>
<action selector="resetChart:" destination="G3o-XK-bQe" eventType="touchUpInside" id="r5Z-4q-2Ai"/>
Expand Down Expand Up @@ -1811,11 +1811,11 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="ong-9I-uNq">
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="bottom" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="ong-9I-uNq">
<rect key="frame" x="360.33333333333331" y="0.0" width="19.666666666666686" height="82"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MWZ-8O-k0d">
<rect key="frame" x="0.0" y="0.0" width="19.666666666666668" height="22"/>
<rect key="frame" x="1.6666666666666856" y="0.0" width="18" height="22"/>
<state key="normal" image="plus" catalog="system"/>
<connections>
<action selector="addExpensesCategoryHome:" destination="G3o-XK-bQe" eventType="touchUpInside" id="Nko-7l-OMl"/>
Expand Down Expand Up @@ -1844,6 +1844,7 @@
<constraint firstItem="ong-9I-uNq" firstAttribute="top" secondItem="Uow-25-bR3" secondAttribute="top" id="9r5-vd-Nyi"/>
<constraint firstItem="ong-9I-uNq" firstAttribute="width" secondItem="Rlm-f2-gou" secondAttribute="width" id="NfG-5Y-DJv"/>
<constraint firstAttribute="bottom" secondItem="ong-9I-uNq" secondAttribute="bottom" id="PsP-TC-oM0"/>
<constraint firstAttribute="height" constant="82" id="d9A-2J-FaS"/>
<constraint firstItem="Rlm-f2-gou" firstAttribute="top" secondItem="Uow-25-bR3" secondAttribute="top" id="gR4-jh-XeZ"/>
<constraint firstAttribute="bottom" secondItem="Rlm-f2-gou" secondAttribute="bottom" id="gob-MA-5UQ"/>
</constraints>
Expand Down
32 changes: 19 additions & 13 deletions ฿u₫g€+/฿u₫g€+/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class projectedIncome: Codable {
static func loadSampleData() -> [projectedIncome] {
let incomeArray: [projectedIncome] = [
projectedIncome(incomeName: "Salary", incomeMoney: 5000),
projectedIncome(incomeName: "Other", incomeMoney: 6*7*20),
// projectedIncome(incomeName: "Other", incomeMoney: 6*7*20),
projectedIncome(incomeName: "Savings", incomeMoney: 0)
]
return incomeArray
Expand Down Expand Up @@ -80,12 +80,18 @@ class expenseStruct: Codable {

static func loadSampleData() -> [expenseStruct] {
let expensesArray: [expenseStruct] = [
expenseStruct(categoryName: "Healthcare", projectedExpenses: 1000, actualExpenses: 600.00),
expenseStruct(categoryName: "Transport", projectedExpenses: 900, actualExpenses: 500.00),
expenseStruct(categoryName: "Food", projectedExpenses: 800, actualExpenses: 400.00),
expenseStruct(categoryName: "Gaming", projectedExpenses: 700, actualExpenses: 300.00),
expenseStruct(categoryName: "Entertainment", projectedExpenses: 600, actualExpenses: 200.00),
expenseStruct(categoryName: "Others", projectedExpenses: 500, actualExpenses: 100.00),
// expenseStruct(categoryName: "Healthcare", projectedExpenses: 1000, actualExpenses: 600.00),
// expenseStruct(categoryName: "Transport", projectedExpenses: 900, actualExpenses: 500.00),
// expenseStruct(categoryName: "Food", projectedExpenses: 800, actualExpenses: 400.00),
// expenseStruct(categoryName: "Gaming", projectedExpenses: 700, actualExpenses: 300.00),
// expenseStruct(categoryName: "Entertainment", projectedExpenses: 600, actualExpenses: 200.00),
// expenseStruct(categoryName: "Others", projectedExpenses: 500, actualExpenses: 100.00),
expenseStruct(categoryName: "Healthcare", projectedExpenses: 100, actualExpenses: 0.00),
expenseStruct(categoryName: "Transport", projectedExpenses: 100, actualExpenses: 0.00),
expenseStruct(categoryName: "Food", projectedExpenses: 100, actualExpenses: 0.00),
expenseStruct(categoryName: "Gaming", projectedExpenses: 100, actualExpenses: 0.00),
expenseStruct(categoryName: "Entertainment", projectedExpenses: 100, actualExpenses: 0.00),
expenseStruct(categoryName: "Others", projectedExpenses: 100, actualExpenses: 0.00),
]
return expensesArray
}
Expand Down Expand Up @@ -128,12 +134,12 @@ struct WishlistItem: Codable {

static func loadSampleData() -> [WishlistItem] {
let wishlist: [WishlistItem] = [
WishlistItem(name: "Watch", category: "Luxury", price: 300, months: 3,url: "https://sstinc.org"),
WishlistItem(name: "Gaming Chair", category: "Entertainment", price: 440.00, months: 11,url: "https://wikipedia.org"),
WishlistItem(name: "Running Shoes", category: "Sports", price: 100.00, months: 20, url: "https://youtube.com"),
WishlistItem(name: "New Television", category: "Electronics", price: 1500.00, months: 3),
WishlistItem(name: "Couch", category: "Furniture", price: 245.00, months: 6),
WishlistItem(name: "Printer", category: "Office", price: 218.00, months: 3)
// WishlistItem(name: "Watch", category: "Luxury", price: 300, months: 3,url: "https://sstinc.org"),
// WishlistItem(name: "Gaming Chair", category: "Entertainment", price: 440.00, months: 11,url: "https://wikipedia.org"),
// WishlistItem(name: "Running Shoes", category: "Sports", price: 100.00, months: 20, url: "https://youtube.com"),
// WishlistItem(name: "New Television", category: "Electronics", price: 1500.00, months: 3),
// WishlistItem(name: "Couch", category: "Furniture", price: 245.00, months: 6),
// WishlistItem(name: "Printer", category: "Office", price: 218.00, months: 3)
]
return wishlist
}
Expand Down
63 changes: 32 additions & 31 deletions ฿u₫g€+/฿u₫g€+/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ class ViewController: UIViewController {
// print(projectedIncome.loadSampleData())
// print(projectedIncome.loadFromFile()!)
wishlistView.isUserInteractionEnabled = true
spendingsView.layer.cornerRadius = 20
spendingsView.layer.cornerRadius = 15
spendingsView.layer.masksToBounds = true
savingsView.layer.cornerRadius = 20
savingsView.layer.cornerRadius = 15
savingsView.layer.masksToBounds = true
wishlistView.layer.cornerRadius = 20
wishlistView.layer.cornerRadius = 15
wishlistView.layer.masksToBounds = true
nameLabel.adjustsFontSizeToFitWidth = true
spendingsView.isUserInteractionEnabled = true
Expand Down Expand Up @@ -219,6 +219,7 @@ class ViewController: UIViewController {
}

override func viewWillAppear(_ animated: Bool) {
noSpendingLabel.isHidden = true
self.timer = Timer.scheduledTimer(timeInterval: 60.0, target: self, selector: #selector(updateSpendings), userInfo: nil, repeats: true)
if let name = UserDefaults.standard.string(forKey: "username") {
nameLabel.attributedText = NSMutableAttributedString().normal30("Hello, ").bold30("\(name)")
Expand All @@ -233,24 +234,25 @@ class ViewController: UIViewController {
updateGlobalSavings()
setupBarChart()
setupPieChart()
updateChart()
if expensesArray.count == 0 {
restartButton.isHidden = true
pageControl.isHidden = true
pieView.isHidden = true
barView.isHidden = true
noSpendingLabel.isHidden = false
noSpendingLabel.text = """
😔
Uh oh! We couldnt find any information about your spendings.
 
Click on the "+" button to add new values!
"""
// pieView.isHidden = true
// barView.isHidden = true
// noSpendingLabel.isHidden = false
// noSpendingLabel.text = """
//😔
Uh oh! We couldnt find any information about your spendings.
 
Click on the "+" button to add new values!
//"""
swipeLeftGesture.isEnabled = false
swipeRightGesture.isEnabled = false
} else {
restartButton.isHidden = false
pageControl.isHidden = false
noSpendingLabel.isHidden = true
// noSpendingLabel.isHidden = true
swipeLeftGesture.isEnabled = true
swipeRightGesture.isEnabled = true
updateChart()
// updateChart()
}
if #available(iOS 13.0, *) {
let appearance = UINavigationBarAppearance()
Expand Down Expand Up @@ -312,7 +314,6 @@ class ViewController: UIViewController {
func setupPieChart() {
pieView.noDataText = "No Data Available for Pie Chart"
if expensesArray.count != 0 {

// MARK: Set Data for Pie Chart
// Set up array
var pieEntries: [PieChartDataEntry] = []
Expand All @@ -327,19 +328,19 @@ class ViewController: UIViewController {
if allvalzero == true {
restartButton.isHidden = true
pageControl.isHidden = true
pieView.isHidden = true
// pieView.noDataText = "No Spendings"
// pieView.isHidden = true
pieView.noDataText = "No Spendings"
pieView.clear()
rotateClockWiseTop.isHidden = true
rotateClockWiseBottom.isHidden = true
rotateAntiClockWiseTop.isHidden = true
rotateAntiClockWiseBottom.isHidden = true
noSpendingLabel.isHidden = false
noSpendingLabel.text = """
No spendings currently made this month
Tap to show spendings and savings
"""
// noSpendingLabel.isHidden = false
// noSpendingLabel.text = """
//No spendings currently made this month
//
//Tap to show spendings and savings
//"""
swipeLeftGesture.isEnabled = false
swipeRightGesture.isEnabled = false
} else {
Expand Down Expand Up @@ -423,26 +424,26 @@ Tap to show spendings and savings
}
if allvalzero == true {
restartButton.isHidden = true
pageControl.isHidden = true
barView.isHidden = true
noSpendingLabel.isHidden = false
noSpendingLabel.text = """
No spendings currently made this month
Tap to show spendings and savings
"""
// barView.noDataText = "No Spendings"
// pageControl.isHidden = true
// barView.isHidden = true
// noSpendingLabel.isHidden = false
// noSpendingLabel.text = """
//No spendings currently made this month
//
//Tap to show spendings and savings
//"""
barView.noDataText = "No Spendings"
barView.clear()
zoomInButton.isHidden = true
zoomOutButton.isHidden = true
swipeLeftGesture.isEnabled = false
swipeRightGesture.isEnabled = false
} else {
updateChart()
// updateChart()
restartButton.isHidden = false
pageControl.isHidden = false
// barView.isHidden = false
noSpendingLabel.isHidden = true
// noSpendingLabel.isHidden = true
swipeLeftGesture.isEnabled = true
swipeRightGesture.isEnabled = true
let chartDataSet = BarChartDataSet(entries: barEntries, label: nil)
Expand Down

0 comments on commit d3e2ba8

Please sign in to comment.