WIP: Implement budget details view

Signed-off-by: Billy Brawner <billy@wbrawner.com>
This commit is contained in:
Billy Brawner 2019-10-20 12:08:12 -07:00
parent 84bb2e2176
commit 35ec26395a
8 changed files with 118 additions and 1775 deletions

View file

@ -11,6 +11,8 @@
282126622357E45F00072D52 /* TransactionEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 282126612357E45F00072D52 /* TransactionEditView.swift */; };
282126A1235929B800072D52 /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 282126A0235929B800072D52 /* ProfileView.swift */; };
282126A3235ABC1800072D52 /* BudgetAppInMemoryCacheService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 282126A2235ABC1800072D52 /* BudgetAppInMemoryCacheService.swift */; };
282126BB235CDD3C00072D52 /* BudgetDetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 282126BA235CDD3C00072D52 /* BudgetDetailsView.swift */; };
282126BD235CDE1400072D52 /* ProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 282126BC235CDE1400072D52 /* ProgressView.swift */; };
284102252341998300EAFA29 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 284102242341998300EAFA29 /* ContentView.swift */; };
2841022723419A2B00EAFA29 /* TabbedBudgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2841022623419A2B00EAFA29 /* TabbedBudgetView.swift */; };
2841022C2342D8E400EAFA29 /* Budget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2841022B2342D8E400EAFA29 /* Budget.swift */; };
@ -70,6 +72,9 @@
282126612357E45F00072D52 /* TransactionEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionEditView.swift; sourceTree = "<group>"; };
282126A0235929B800072D52 /* ProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; };
282126A2235ABC1800072D52 /* BudgetAppInMemoryCacheService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BudgetAppInMemoryCacheService.swift; sourceTree = "<group>"; };
282126A4235BCB7500072D52 /* BudgetApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = BudgetApp.entitlements; sourceTree = "<group>"; };
282126BA235CDD3C00072D52 /* BudgetDetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BudgetDetailsView.swift; sourceTree = "<group>"; };
282126BC235CDE1400072D52 /* ProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressView.swift; sourceTree = "<group>"; };
284102242341998300EAFA29 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
2841022623419A2B00EAFA29 /* TabbedBudgetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabbedBudgetView.swift; sourceTree = "<group>"; };
2841022B2342D8E400EAFA29 /* Budget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Budget.swift; sourceTree = "<group>"; };
@ -155,6 +160,7 @@
2841022B2342D8E400EAFA29 /* Budget.swift */,
28FE6AF32342E3CB00D5543E /* BudgetsDataStore.swift */,
28FE6AF52342E4CC00D5543E /* BudgetRepository.swift */,
282126BA235CDD3C00072D52 /* BudgetDetailsView.swift */,
);
path = Budget;
sourceTree = "<group>";
@ -174,6 +180,7 @@
isa = PBXGroup;
children = (
2857EAEC233DA30B0026BC83 /* LoadingView.swift */,
282126BC235CDE1400072D52 /* ProgressView.swift */,
);
path = Views;
sourceTree = "<group>";
@ -201,6 +208,7 @@
28AC94EC233C373900BFB70A /* BudgetApp */ = {
isa = PBXGroup;
children = (
282126A4235BCB7500072D52 /* BudgetApp.entitlements */,
2821269F2359299D00072D52 /* Profile */,
2841022A2342D8CB00EAFA29 /* Category */,
284102292342D8BB00EAFA29 /* Budget */,
@ -434,6 +442,7 @@
28AC952C233C434800BFB70A /* UserRepository.swift in Sources */,
28FE6B04234449DC00D5543E /* TransactionListView.swift in Sources */,
28AC94F2233C373900BFB70A /* LoginView.swift in Sources */,
282126BB235CDD3C00072D52 /* BudgetDetailsView.swift in Sources */,
28AC9525233C42D100BFB70A /* BudgetAppApiService.swift in Sources */,
2888234723512DBF003D3847 /* Observable.swift in Sources */,
2857EAED233DA30B0026BC83 /* LoadingView.swift in Sources */,
@ -451,6 +460,7 @@
28FE6B022344331B00D5543E /* TransactionDataStore.swift in Sources */,
543ECE42233E82A40018A9D9 /* AuthenticationDataStore.swift in Sources */,
284102302342D97300EAFA29 /* BudgetListsView.swift in Sources */,
282126BD235CDE1400072D52 /* ProgressView.swift in Sources */,
28AC952E233C43A300BFB70A /* User.swift in Sources */,
28CE8B9523525F990072BC4C /* Extensions.swift in Sources */,
);
@ -631,9 +641,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = BudgetApp/BudgetApp.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_ASSET_PATHS = "\"BudgetApp/Preview Content\"";
DEVELOPMENT_TEAM = VJ33S6H7W7;
DEVELOPMENT_TEAM = 9Z6DE6KNJ9;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = BudgetApp/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
@ -642,6 +655,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.wbrawner.budget.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
@ -651,9 +665,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = BudgetApp/BudgetApp.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_ASSET_PATHS = "\"BudgetApp/Preview Content\"";
DEVELOPMENT_TEAM = VJ33S6H7W7;
DEVELOPMENT_TEAM = 9Z6DE6KNJ9;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = BudgetApp/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
@ -662,6 +679,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.wbrawner.budget.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
@ -673,6 +691,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 9Z6DE6KNJ9;
INFOPLIST_FILE = BudgetAppTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
@ -694,6 +713,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 9Z6DE6KNJ9;
INFOPLIST_FILE = BudgetAppTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
@ -714,6 +734,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 9Z6DE6KNJ9;
INFOPLIST_FILE = BudgetAppUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@ -733,6 +754,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 9Z6DE6KNJ9;
INFOPLIST_FILE = BudgetAppUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",

View file

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>BudgetApp.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>28AC94E9233C373900BFB70A</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>28AC94FF233C373A00BFB70A</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>28AC950A233C373A00BFB70A</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View file

@ -0,0 +1,33 @@
//
// BudgetDetailsView.swift
// BudgetApp
//
// Created by Billy Brawner on 10/20/19.
// Copyright © 2019 William Brawner. All rights reserved.
//
import SwiftUI
struct BudgetDetailsView: View {
var body: some View {
ScrollView {
VStack {
// ProgressView(value: .constant(50.0, maxValue: 100))
CategoryListView(self.dataStoreProvider, budget: budget)
}
}
}
let dataStoreProvider: DataStoreProvider
let budget: Budget
init(_ dataStoreProvider: DataStoreProvider, budget: Budget) {
self.dataStoreProvider = dataStoreProvider
self.budget = budget
}
}
struct BudgetDetailsView_Previews: PreviewProvider {
static var previews: some View {
BudgetDetailsView(MockDataStoreProvider(), budget: MockBudgetRepository.budget)
}
}

View file

@ -53,7 +53,7 @@ struct BudgetListItemView: View {
var body: some View {
NavigationLink(
destination: CategoryListView(self.dataStoreProvider, budget: budget)
destination: BudgetDetailsView(self.dataStoreProvider, budget: budget)
.navigationBarTitle(budget.name)
) {
VStack(alignment: .leading) {

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

View file

@ -18,6 +18,8 @@
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.finance</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>

View file

@ -0,0 +1,48 @@
//
// ProgressView.swift
// BudgetApp
//
// Created by Billy Brawner on 10/20/19.
// Copyright © 2019 William Brawner. All rights reserved.
//
import SwiftUI
struct ProgressView: View {
@Binding var value: CGFloat
var maxValue: CGFloat = 100.0
var progressTintColor: Color = .blue
var progressBarHeight: CGFloat = 20
var progressBarCornerRadius: CGFloat = 4.0
var body: some View {
GeometryReader { geometry in
ZStack(alignment: .leading) {
Rectangle()
.opacity(0.1)
Rectangle()
.frame(
minWidth: 0,
idealWidth: self.getProgressBarWidth(geometry: geometry),
maxWidth: self.getProgressBarWidth(geometry: geometry)
)
.opacity(0.5)
.background(self.progressTintColor)
.animation(.default)
}.frame(height: self.progressBarHeight)
.cornerRadius(self.progressBarCornerRadius)
}
}
private func getProgressBarWidth(geometry: GeometryProxy) -> CGFloat {
let frame = geometry.frame(in: .global)
return frame.size.width * (value / maxValue)
}
}
struct ProgressView_Previews: PreviewProvider {
static var previews: some View {
ProgressView(value: .constant(50.0), maxValue: 100.0, progressTintColor: .red)
}
}