diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo.xcodeproj/project.pbxproj b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo.xcodeproj/project.pbxproj new file mode 100644 index 0000000..212663a --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo.xcodeproj/project.pbxproj @@ -0,0 +1,400 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + 30E6CB872942DF780088A9A3 /* SwiftYNAB_SwiftUI_demoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CB862942DF780088A9A3 /* SwiftYNAB_SwiftUI_demoApp.swift */; }; + 30E6CB892942DF780088A9A3 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CB882942DF780088A9A3 /* ContentView.swift */; }; + 30E6CB8B2942DF790088A9A3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 30E6CB8A2942DF790088A9A3 /* Assets.xcassets */; }; + 30E6CB8E2942DF790088A9A3 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 30E6CB8D2942DF790088A9A3 /* Preview Assets.xcassets */; }; + 30E6CB952942E1800088A9A3 /* BudgetsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CB942942E1800088A9A3 /* BudgetsView.swift */; }; + 30E6CB982942E7250088A9A3 /* SwiftYNAB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30E6CB972942E7250088A9A3 /* SwiftYNAB.framework */; }; + 30E6CB9C294354360088A9A3 /* Budget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CB9B294354360088A9A3 /* Budget.swift */; }; + 30E6CB9E2943551A0088A9A3 /* BudgetViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CB9D2943551A0088A9A3 /* BudgetViewModel.swift */; }; + 30E6CBA02944282E0088A9A3 /* AccountsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CB9F2944282E0088A9A3 /* AccountsView.swift */; }; + 30E6CBA2294432D00088A9A3 /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CBA1294432D00088A9A3 /* Account.swift */; }; + 30E6CBA42944333D0088A9A3 /* AccountsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CBA32944333D0088A9A3 /* AccountsViewModel.swift */; }; + 30E6CBA6294435990088A9A3 /* AccountRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CBA5294435990088A9A3 /* AccountRowView.swift */; }; + 30E6CBA8294439B20088A9A3 /* TransactionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CBA7294439B20088A9A3 /* TransactionsView.swift */; }; + 30E6CBAA294439CA0088A9A3 /* TransactionsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CBA9294439CA0088A9A3 /* TransactionsViewModel.swift */; }; + 30E6CBAC294439ED0088A9A3 /* Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CBAB294439ED0088A9A3 /* Transaction.swift */; }; + 30E6CBAE29443D4B0088A9A3 /* TransactionRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E6CBAD29443D4B0088A9A3 /* TransactionRowView.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 30E6CB832942DF780088A9A3 /* SwiftYNAB-SwiftUI-demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SwiftYNAB-SwiftUI-demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 30E6CB862942DF780088A9A3 /* SwiftYNAB_SwiftUI_demoApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftYNAB_SwiftUI_demoApp.swift; sourceTree = ""; }; + 30E6CB882942DF780088A9A3 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 30E6CB8A2942DF790088A9A3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 30E6CB8D2942DF790088A9A3 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 30E6CB942942E1800088A9A3 /* BudgetsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BudgetsView.swift; sourceTree = ""; }; + 30E6CB972942E7250088A9A3 /* SwiftYNAB.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftYNAB.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 30E6CB9B294354360088A9A3 /* Budget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Budget.swift; sourceTree = ""; }; + 30E6CB9D2943551A0088A9A3 /* BudgetViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BudgetViewModel.swift; sourceTree = ""; }; + 30E6CB9F2944282E0088A9A3 /* AccountsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountsView.swift; sourceTree = ""; }; + 30E6CBA1294432D00088A9A3 /* Account.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Account.swift; sourceTree = ""; }; + 30E6CBA32944333D0088A9A3 /* AccountsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountsViewModel.swift; sourceTree = ""; }; + 30E6CBA5294435990088A9A3 /* AccountRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountRowView.swift; sourceTree = ""; }; + 30E6CBA7294439B20088A9A3 /* TransactionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionsView.swift; sourceTree = ""; }; + 30E6CBA9294439CA0088A9A3 /* TransactionsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionsViewModel.swift; sourceTree = ""; }; + 30E6CBAB294439ED0088A9A3 /* Transaction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Transaction.swift; sourceTree = ""; }; + 30E6CBAD29443D4B0088A9A3 /* TransactionRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionRowView.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 30E6CB802942DF780088A9A3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 30E6CB982942E7250088A9A3 /* SwiftYNAB.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 30E6CB7A2942DF780088A9A3 = { + isa = PBXGroup; + children = ( + 30E6CB852942DF780088A9A3 /* SwiftYNAB-SwiftUI-demo */, + 30E6CB842942DF780088A9A3 /* Products */, + 30E6CB962942E7250088A9A3 /* Frameworks */, + ); + sourceTree = ""; + }; + 30E6CB842942DF780088A9A3 /* Products */ = { + isa = PBXGroup; + children = ( + 30E6CB832942DF780088A9A3 /* SwiftYNAB-SwiftUI-demo.app */, + ); + name = Products; + sourceTree = ""; + }; + 30E6CB852942DF780088A9A3 /* SwiftYNAB-SwiftUI-demo */ = { + isa = PBXGroup; + children = ( + 30E6CB862942DF780088A9A3 /* SwiftYNAB_SwiftUI_demoApp.swift */, + 30E6CB882942DF780088A9A3 /* ContentView.swift */, + 30E6CBA1294432D00088A9A3 /* Account.swift */, + 30E6CBA5294435990088A9A3 /* AccountRowView.swift */, + 30E6CB9F2944282E0088A9A3 /* AccountsView.swift */, + 30E6CBA32944333D0088A9A3 /* AccountsViewModel.swift */, + 30E6CB9B294354360088A9A3 /* Budget.swift */, + 30E6CB942942E1800088A9A3 /* BudgetsView.swift */, + 30E6CB9D2943551A0088A9A3 /* BudgetViewModel.swift */, + 30E6CBAB294439ED0088A9A3 /* Transaction.swift */, + 30E6CBAD29443D4B0088A9A3 /* TransactionRowView.swift */, + 30E6CBA7294439B20088A9A3 /* TransactionsView.swift */, + 30E6CBA9294439CA0088A9A3 /* TransactionsViewModel.swift */, + 30E6CB8A2942DF790088A9A3 /* Assets.xcassets */, + 30E6CB8C2942DF790088A9A3 /* Preview Content */, + ); + path = "SwiftYNAB-SwiftUI-demo"; + sourceTree = ""; + }; + 30E6CB8C2942DF790088A9A3 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 30E6CB8D2942DF790088A9A3 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 30E6CB962942E7250088A9A3 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 30E6CB972942E7250088A9A3 /* SwiftYNAB.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 30E6CB822942DF780088A9A3 /* SwiftYNAB-SwiftUI-demo */ = { + isa = PBXNativeTarget; + buildConfigurationList = 30E6CB912942DF790088A9A3 /* Build configuration list for PBXNativeTarget "SwiftYNAB-SwiftUI-demo" */; + buildPhases = ( + 30E6CB7F2942DF780088A9A3 /* Sources */, + 30E6CB802942DF780088A9A3 /* Frameworks */, + 30E6CB812942DF780088A9A3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SwiftYNAB-SwiftUI-demo"; + productName = "SwiftYNAB-SwiftUI-demo"; + productReference = 30E6CB832942DF780088A9A3 /* SwiftYNAB-SwiftUI-demo.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 30E6CB7B2942DF780088A9A3 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1410; + LastUpgradeCheck = 1410; + TargetAttributes = { + 30E6CB822942DF780088A9A3 = { + CreatedOnToolsVersion = 14.1; + }; + }; + }; + buildConfigurationList = 30E6CB7E2942DF780088A9A3 /* Build configuration list for PBXProject "SwiftYNAB-SwiftUI-demo" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 30E6CB7A2942DF780088A9A3; + productRefGroup = 30E6CB842942DF780088A9A3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 30E6CB822942DF780088A9A3 /* SwiftYNAB-SwiftUI-demo */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 30E6CB812942DF780088A9A3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 30E6CB8E2942DF790088A9A3 /* Preview Assets.xcassets in Resources */, + 30E6CB8B2942DF790088A9A3 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 30E6CB7F2942DF780088A9A3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 30E6CB9E2943551A0088A9A3 /* BudgetViewModel.swift in Sources */, + 30E6CB892942DF780088A9A3 /* ContentView.swift in Sources */, + 30E6CBA02944282E0088A9A3 /* AccountsView.swift in Sources */, + 30E6CBAE29443D4B0088A9A3 /* TransactionRowView.swift in Sources */, + 30E6CB952942E1800088A9A3 /* BudgetsView.swift in Sources */, + 30E6CB9C294354360088A9A3 /* Budget.swift in Sources */, + 30E6CBA8294439B20088A9A3 /* TransactionsView.swift in Sources */, + 30E6CBAC294439ED0088A9A3 /* Transaction.swift in Sources */, + 30E6CBAA294439CA0088A9A3 /* TransactionsViewModel.swift in Sources */, + 30E6CBA6294435990088A9A3 /* AccountRowView.swift in Sources */, + 30E6CB872942DF780088A9A3 /* SwiftYNAB_SwiftUI_demoApp.swift in Sources */, + 30E6CBA42944333D0088A9A3 /* AccountsViewModel.swift in Sources */, + 30E6CBA2294432D00088A9A3 /* Account.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 30E6CB8F2942DF790088A9A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 30E6CB902942DF790088A9A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 30E6CB922942DF790088A9A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"SwiftYNAB-SwiftUI-demo/Preview Content\""; + DEVELOPMENT_TEAM = 82638A44Y2; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.andrebocchini.swiftynab-swiftui.SwiftYNAB-SwiftUI-demo"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 30E6CB932942DF790088A9A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"SwiftYNAB-SwiftUI-demo/Preview Content\""; + DEVELOPMENT_TEAM = 82638A44Y2; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.andrebocchini.swiftynab-swiftui.SwiftYNAB-SwiftUI-demo"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 30E6CB7E2942DF780088A9A3 /* Build configuration list for PBXProject "SwiftYNAB-SwiftUI-demo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 30E6CB8F2942DF790088A9A3 /* Debug */, + 30E6CB902942DF790088A9A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 30E6CB912942DF790088A9A3 /* Build configuration list for PBXNativeTarget "SwiftYNAB-SwiftUI-demo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 30E6CB922942DF790088A9A3 /* Debug */, + 30E6CB932942DF790088A9A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 30E6CB7B2942DF780088A9A3 /* Project object */; +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Account.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Account.swift new file mode 100644 index 0000000..7900e1c --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Account.swift @@ -0,0 +1,68 @@ +// +// Account.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/9/22. +// + +import Foundation +import SwiftYNAB + +struct Account { + enum Kind: String { + case autoLoan = "autoLoan" + case cash = "cash" + case checking = "checking" + case creditCard = "creditCard" + case mortgage = "mortgage" + case otherDebt = "otherDebt" + case savings = "savings" + case unknown + + var display: String { + switch self { + case .autoLoan: + return "Auto Loan" + case .cash: + return "Cash" + case .checking: + return "Checking" + case .creditCard: + return "Credit Card" + case .mortgage: + return "Mortgage" + case .otherDebt: + return "Other Debt" + case .savings: + return "Savings" + case .unknown: + return "Unknown" + } + } + } + + let id: String + let name: String + let kind: Kind + let balance: String + let closed: Bool + +} + +extension Account { + init(account: SwiftYNAB.Account, budget: Budget) { + self.id = account.id + self.name = account.name + + if let kind = Kind(rawValue: account.type) { + self.kind = kind + } else { + self.kind = .unknown + } + + let currencyFormatter = CurrencyFormatter(currencyFormat: budget.currencyFormat) + self.balance = currencyFormatter.currencyString(from: account.balance) ?? "" + + self.closed = account.closed + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/AccountRowView.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/AccountRowView.swift new file mode 100644 index 0000000..9f7050a --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/AccountRowView.swift @@ -0,0 +1,31 @@ +// +// AccountRowView.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/9/22. +// + +import Foundation +import SwiftUI + +struct AccountRowView: View { + let account: Account + + var body: some View { + HStack(spacing: 8) { + VStack(spacing: 8) { + Text(account.name) + .font(.headline) + .frame(maxWidth: .infinity, alignment: .leading) + Text(account.kind.display) + .font(.subheadline) + .frame(maxWidth: .infinity, alignment: .leading) + } + .frame(maxWidth: .infinity) + + Text(account.balance) + .font(.subheadline) + .frame(alignment: .trailing) + } + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/AccountsView.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/AccountsView.swift new file mode 100644 index 0000000..f6f112d --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/AccountsView.swift @@ -0,0 +1,47 @@ +// +// AccountsView.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/9/22. +// + +import Foundation +import SwiftUI + +struct AccountsView: View { + @Binding var token: String + + @State var viewModel: AccountsViewModelType + + var body: some View { + VStack { + if viewModel.isLoading { + ProgressView() + .progressViewStyle(.circular) + .scaleEffect(2, anchor: .center) + } else if viewModel.isError { + Text("Error loading accounts!") + } else { + List(viewModel.accounts, id: \.id) { account in + NavigationLink { + TransactionsView( + token: $token, + viewModel: TransactionsViewModel( + budget: viewModel.budget, + account: account + ) + ) + } label: { + AccountRowView(account: account) + } + } + } + } + .navigationTitle("Accounts") + .onAppear { + Task { + await viewModel.fetchAccounts(using: token) + } + } + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/AccountsViewModel.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/AccountsViewModel.swift new file mode 100644 index 0000000..f6b4802 --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/AccountsViewModel.swift @@ -0,0 +1,49 @@ +// +// AccountsViewModel.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/9/22. +// + +import Foundation +import SwiftYNAB + +protocol AccountsViewModelType { + var isLoading: Bool { get } + var isError: Bool { get } + var accounts: [Account] { get } + var budget: Budget { get } + + mutating func fetchAccounts(using token: String) async +} + +struct AccountsViewModel: AccountsViewModelType { + private(set) var isLoading = false + private(set) var isError = false + private(set) var accounts: [Account] = [] + private(set) var budget: Budget +} + +extension AccountsViewModel { + @MainActor mutating func fetchAccounts(using token: String) async { + if !isLoading, !isError { + defer { + isLoading = false + } + + isLoading = true + let ynab = YNAB(accessToken: token) + + do { + let result = try await ynab.accounts.getAccounts(budgetId: budget.id) + accounts = result + .filter({ !$0.closed }) + .map({ Account(account: $0, budget: budget) }) + + isError = false + } catch { + isError = true + } + } + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Assets.xcassets/AccentColor.colorset/Contents.json b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Assets.xcassets/AppIcon.appiconset/Contents.json b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..13613e3 --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Assets.xcassets/Contents.json b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Budget.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Budget.swift new file mode 100644 index 0000000..320ea3b --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Budget.swift @@ -0,0 +1,23 @@ +// +// Budget.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/9/22. +// + +import Foundation +import SwiftYNAB + +struct Budget: Identifiable { + let id: String + let name: String + let currencyFormat: CurrencyFormat +} + +extension Budget { + init(summary: BudgetSummary) { + self.id = summary.id + self.name = summary.name + self.currencyFormat = summary.currencyFormat + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/BudgetViewModel.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/BudgetViewModel.swift new file mode 100644 index 0000000..5cbd85e --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/BudgetViewModel.swift @@ -0,0 +1,45 @@ +// +// BudgetViewModel.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/9/22. +// + +import Foundation +import SwiftYNAB + +protocol BudgetViewModelType { + var isLoading: Bool { get } + var isError: Bool { get } + var budgets: [Budget] { get } + + mutating func fetchBudgets(using token: String) async +} + +struct BudgetViewModel: BudgetViewModelType { + private(set) var isLoading = false + private(set) var isError = false + private(set) var budgets: [Budget] = [] +} + +extension BudgetViewModel { + @MainActor mutating func fetchBudgets(using token: String) async { + if !isLoading, !isError { + defer { + isLoading = false + } + + isLoading = true + let ynab = YNAB(accessToken: token) + + do { + let result = try await ynab.budgets.getBudgets() + budgets = result.map({ Budget(summary: $0) }) + + isError = false + } catch { + isError = true + } + } + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/BudgetsView.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/BudgetsView.swift new file mode 100644 index 0000000..b6f2276 --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/BudgetsView.swift @@ -0,0 +1,41 @@ +// +// BudgetsView.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/8/22. +// + +import Foundation +import SwiftUI + +struct BudgetsView: View { + @Binding var token: String + + @State var viewModel: BudgetViewModelType = BudgetViewModel() + + var body: some View { + VStack { + if viewModel.isLoading { + ProgressView() + .progressViewStyle(.circular) + .scaleEffect(2, anchor: .center) + } else if viewModel.isError { + Text("Error loading budgets!") + } else { + List(viewModel.budgets, id: \.id) { budget in + NavigationLink { + AccountsView(token: $token, viewModel: AccountsViewModel(budget: budget)) + } label: { + Text(budget.name) + } + } + } + } + .navigationTitle("Budgets") + .onAppear { + Task { + await viewModel.fetchBudgets(using: token) + } + } + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/ContentView.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/ContentView.swift new file mode 100644 index 0000000..3a68c9e --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/ContentView.swift @@ -0,0 +1,56 @@ +// +// ContentView.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/8/22. +// + +import SwiftUI + +struct ContentView: View { + @State private var token: String = "" + @State private var navigationPath = NavigationPath() + @State private var isError = false + + var body: some View { + NavigationStack(path: $navigationPath) { + VStack(alignment: .center, spacing: 8) { + Text("Personal API Token") + .font(.title) + TextField("Token Goes Here", text: $token) + .multilineTextAlignment(.center) + .textFieldStyle(.roundedBorder) + Button { + if token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + isError = true + } else { + navigationPath.append(token) + } + } label: { + Text("View Budgets") + .font(.title2) + } + .navigationDestination(for: String.self) { token in + BudgetsView(token: $token) + } + .alert("Error", isPresented: $isError) { + Button { + isError = false + } label: { + Text("Ok") + } + } message: { + Text("You need to enter an API token") + } + } + .padding(8) + } + .navigationTitle("Ynab Demo") + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Preview Content/Preview Assets.xcassets/Contents.json b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/SwiftYNAB_SwiftUI_demoApp.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/SwiftYNAB_SwiftUI_demoApp.swift new file mode 100644 index 0000000..7faa8f3 --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/SwiftYNAB_SwiftUI_demoApp.swift @@ -0,0 +1,17 @@ +// +// SwiftYNAB_SwiftUI_demoApp.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/8/22. +// + +import SwiftUI + +@main +struct SwiftYNAB_SwiftUI_demoApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Transaction.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Transaction.swift new file mode 100644 index 0000000..c37ce70 --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/Transaction.swift @@ -0,0 +1,28 @@ +// +// Transactions.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/9/22. +// + +import Foundation +import SwiftYNAB + +struct Transaction { + let id: String + let amount: String + let date: String + let payee: String +} + +extension Transaction { + init(transaction: TransactionDetail, currencyFormat: CurrencyFormat) { + self.id = transaction.id + + let currencyFormatter = CurrencyFormatter(currencyFormat: currencyFormat) + self.amount = currencyFormatter.currencyString(from: transaction.amount) ?? "" + + self.date = transaction.date + self.payee = transaction.payeeName ?? "" + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/TransactionRowView.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/TransactionRowView.swift new file mode 100644 index 0000000..2fb751d --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/TransactionRowView.swift @@ -0,0 +1,30 @@ +// +// TransactionRowView.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/9/22. +// + +import Foundation +import SwiftUI + +struct TransactionRowView: View { + let transaction: Transaction + + var body: some View { + HStack(spacing: 8) { + VStack(spacing: 8) { + Text(transaction.payee) + .font(.headline) + .frame(maxWidth: .infinity, alignment: .leading) + Text(transaction.date) + .font(.subheadline) + .frame(maxWidth: .infinity, alignment: .leading) + } + .frame(maxWidth: .infinity) + + Text(transaction.amount) + .font(.subheadline) + } + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/TransactionsView.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/TransactionsView.swift new file mode 100644 index 0000000..164e7fc --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/TransactionsView.swift @@ -0,0 +1,37 @@ +// +// TransactionsView.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/9/22. +// + +import Foundation +import SwiftUI + +struct TransactionsView: View { + @Binding var token: String + + @State var viewModel: TransactionsViewModelType + + var body: some View { + VStack { + if viewModel.isLoading { + ProgressView() + .progressViewStyle(.circular) + .scaleEffect(2, anchor: .center) + } else if viewModel.isError { + Text("Error loading transactions!") + } else { + List(viewModel.transactions, id: \.id) { transaction in + TransactionRowView(transaction: transaction) + } + } + } + .navigationTitle("Transactions") + .onAppear { + Task { + await viewModel.fetchTransactions(using: token) + } + } + } +} diff --git a/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/TransactionsViewModel.swift b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/TransactionsViewModel.swift new file mode 100644 index 0000000..632dee6 --- /dev/null +++ b/SwiftYNAB-SwiftUI-demo/SwiftYNAB-SwiftUI-demo/TransactionsViewModel.swift @@ -0,0 +1,59 @@ +// +// TransactionsViewModel.swift +// SwiftYNAB-SwiftUI-demo +// +// Created by Andre Bocchini on 12/9/22. +// + +import Foundation +import SwiftYNAB + +protocol TransactionsViewModelType { + var isLoading: Bool { get } + var isError: Bool { get } + var transactions: [Transaction] { get } + var budget: Budget { get } + var account: Account { get } + + mutating func fetchTransactions(using token: String) async +} + +struct TransactionsViewModel: TransactionsViewModelType { + private(set) var isLoading = false + private(set) var isError = false + private(set) var transactions: [Transaction] = [] + private(set) var budget: Budget + private(set) var account: Account + + init(budget: Budget, account: Account) { + self.budget = budget + self.account = account + } +} + +extension TransactionsViewModel { + @MainActor mutating func fetchTransactions(using token: String) async { + if !isLoading, !isError { + defer { + isLoading = false + } + + isLoading = true + let ynab = YNAB(accessToken: token) + + do { + let result = try await ynab.transactions.getTransactions( + budgetId: budget.id, + accountId: account.id + ) + transactions = result + .map({ Transaction(transaction: $0, currencyFormat: budget.currencyFormat) }) + .reversed() + + isError = false + } catch { + isError = true + } + } + } +} diff --git a/SwiftYNAB.xcworkspace/contents.xcworkspacedata b/SwiftYNAB.xcworkspace/contents.xcworkspacedata index 615a951..fc9c756 100644 --- a/SwiftYNAB.xcworkspace/contents.xcworkspacedata +++ b/SwiftYNAB.xcworkspace/contents.xcworkspacedata @@ -7,4 +7,7 @@ + +