Compare commits
2 Commits
bbee4d44cf
...
534ed4718f
Author | SHA1 | Date |
---|---|---|
|
534ed4718f | |
|
a4ecd54f1e |
|
@ -0,0 +1,617 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 77;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
3D3444682D889F7F00AA3172 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 3D3444482D889F7D00AA3172 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 3D34444F2D889F7D00AA3172;
|
||||
remoteInfo = "Gas Man";
|
||||
};
|
||||
3D3444722D889F8000AA3172 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 3D3444482D889F7D00AA3172 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 3D34444F2D889F7D00AA3172;
|
||||
remoteInfo = "Gas Man";
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
3D3444502D889F7D00AA3172 /* Gas Man.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Gas Man.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3D3444672D889F7F00AA3172 /* Gas ManTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Gas ManTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3D3444712D889F8000AA3172 /* Gas ManUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Gas ManUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||
3D3444792D889F8000AA3172 /* Exceptions for "Gas Man" folder in "Gas Man" target */ = {
|
||||
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
|
||||
membershipExceptions = (
|
||||
Info.plist,
|
||||
);
|
||||
target = 3D34444F2D889F7D00AA3172 /* Gas Man */;
|
||||
};
|
||||
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||
|
||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||
3D3444522D889F7D00AA3172 /* Gas Man */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
exceptions = (
|
||||
3D3444792D889F8000AA3172 /* Exceptions for "Gas Man" folder in "Gas Man" target */,
|
||||
);
|
||||
path = "Gas Man";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3D34446A2D889F7F00AA3172 /* Gas ManTests */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
path = "Gas ManTests";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3D3444742D889F8000AA3172 /* Gas ManUITests */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
path = "Gas ManUITests";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
3D34444D2D889F7D00AA3172 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3D3444642D889F7F00AA3172 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3D34446E2D889F8000AA3172 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
3D3444472D889F7D00AA3172 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D3444522D889F7D00AA3172 /* Gas Man */,
|
||||
3D34446A2D889F7F00AA3172 /* Gas ManTests */,
|
||||
3D3444742D889F8000AA3172 /* Gas ManUITests */,
|
||||
3D3444512D889F7D00AA3172 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3D3444512D889F7D00AA3172 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D3444502D889F7D00AA3172 /* Gas Man.app */,
|
||||
3D3444672D889F7F00AA3172 /* Gas ManTests.xctest */,
|
||||
3D3444712D889F8000AA3172 /* Gas ManUITests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
3D34444F2D889F7D00AA3172 /* Gas Man */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 3D34447A2D889F8000AA3172 /* Build configuration list for PBXNativeTarget "Gas Man" */;
|
||||
buildPhases = (
|
||||
3D34444C2D889F7D00AA3172 /* Sources */,
|
||||
3D34444D2D889F7D00AA3172 /* Frameworks */,
|
||||
3D34444E2D889F7D00AA3172 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
3D3444522D889F7D00AA3172 /* Gas Man */,
|
||||
);
|
||||
name = "Gas Man";
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = "Gas Man";
|
||||
productReference = 3D3444502D889F7D00AA3172 /* Gas Man.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
3D3444662D889F7F00AA3172 /* Gas ManTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 3D34447F2D889F8000AA3172 /* Build configuration list for PBXNativeTarget "Gas ManTests" */;
|
||||
buildPhases = (
|
||||
3D3444632D889F7F00AA3172 /* Sources */,
|
||||
3D3444642D889F7F00AA3172 /* Frameworks */,
|
||||
3D3444652D889F7F00AA3172 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
3D3444692D889F7F00AA3172 /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
3D34446A2D889F7F00AA3172 /* Gas ManTests */,
|
||||
);
|
||||
name = "Gas ManTests";
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = "Gas ManTests";
|
||||
productReference = 3D3444672D889F7F00AA3172 /* Gas ManTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
3D3444702D889F8000AA3172 /* Gas ManUITests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 3D3444822D889F8000AA3172 /* Build configuration list for PBXNativeTarget "Gas ManUITests" */;
|
||||
buildPhases = (
|
||||
3D34446D2D889F8000AA3172 /* Sources */,
|
||||
3D34446E2D889F8000AA3172 /* Frameworks */,
|
||||
3D34446F2D889F8000AA3172 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
3D3444732D889F8000AA3172 /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
3D3444742D889F8000AA3172 /* Gas ManUITests */,
|
||||
);
|
||||
name = "Gas ManUITests";
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = "Gas ManUITests";
|
||||
productReference = 3D3444712D889F8000AA3172 /* Gas ManUITests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.ui-testing";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
3D3444482D889F7D00AA3172 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastSwiftUpdateCheck = 1610;
|
||||
LastUpgradeCheck = 1610;
|
||||
TargetAttributes = {
|
||||
3D34444F2D889F7D00AA3172 = {
|
||||
CreatedOnToolsVersion = 16.1;
|
||||
};
|
||||
3D3444662D889F7F00AA3172 = {
|
||||
CreatedOnToolsVersion = 16.1;
|
||||
TestTargetID = 3D34444F2D889F7D00AA3172;
|
||||
};
|
||||
3D3444702D889F8000AA3172 = {
|
||||
CreatedOnToolsVersion = 16.1;
|
||||
TestTargetID = 3D34444F2D889F7D00AA3172;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 3D34444B2D889F7D00AA3172 /* Build configuration list for PBXProject "Gas Man" */;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 3D3444472D889F7D00AA3172;
|
||||
minimizedProjectReferenceProxies = 1;
|
||||
preferredProjectObjectVersion = 77;
|
||||
productRefGroup = 3D3444512D889F7D00AA3172 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
3D34444F2D889F7D00AA3172 /* Gas Man */,
|
||||
3D3444662D889F7F00AA3172 /* Gas ManTests */,
|
||||
3D3444702D889F8000AA3172 /* Gas ManUITests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
3D34444E2D889F7D00AA3172 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3D3444652D889F7F00AA3172 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3D34446F2D889F8000AA3172 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
3D34444C2D889F7D00AA3172 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3D3444632D889F7F00AA3172 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3D34446D2D889F8000AA3172 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
3D3444692D889F7F00AA3172 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 3D34444F2D889F7D00AA3172 /* Gas Man */;
|
||||
targetProxy = 3D3444682D889F7F00AA3172 /* PBXContainerItemProxy */;
|
||||
};
|
||||
3D3444732D889F8000AA3172 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 3D34444F2D889F7D00AA3172 /* Gas Man */;
|
||||
targetProxy = 3D3444722D889F8000AA3172 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
3D34447B2D889F8000AA3172 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = "Gas Man/Gas_Man.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"Gas Man/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = Z734T5CD6B;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "Gas Man/Info.plist";
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.travel";
|
||||
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES;
|
||||
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES;
|
||||
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES;
|
||||
INFOPLIST_KEY_UIStatusBarStyle = UIStatusBarStyleDarkContent;
|
||||
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault;
|
||||
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.1;
|
||||
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
|
||||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 14.6;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "pro.thelinux.Gas-Man";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = auto;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
XROS_DEPLOYMENT_TARGET = 2.1;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3D34447C2D889F8000AA3172 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = "Gas Man/Gas_Man.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"Gas Man/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = Z734T5CD6B;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "Gas Man/Info.plist";
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.travel";
|
||||
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
|
||||
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES;
|
||||
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES;
|
||||
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES;
|
||||
INFOPLIST_KEY_UIStatusBarStyle = UIStatusBarStyleDarkContent;
|
||||
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault;
|
||||
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.1;
|
||||
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
|
||||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 14.6;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "pro.thelinux.Gas-Man";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = auto;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
XROS_DEPLOYMENT_TARGET = 2.1;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
3D34447D2D889F8000AA3172 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
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;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
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;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3D34447E2D889F8000AA3172 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
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;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
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;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
3D3444802D889F8000AA3172 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = Z734T5CD6B;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.1;
|
||||
MACOSX_DEPLOYMENT_TARGET = 14.7;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "pro.thelinux.Gas-ManTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = auto;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,7";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Gas Man.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Gas Man";
|
||||
XROS_DEPLOYMENT_TARGET = 2.1;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3D3444812D889F8000AA3172 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = Z734T5CD6B;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.1;
|
||||
MACOSX_DEPLOYMENT_TARGET = 14.7;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "pro.thelinux.Gas-ManTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = auto;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,7";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Gas Man.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Gas Man";
|
||||
XROS_DEPLOYMENT_TARGET = 2.1;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
3D3444832D889F8000AA3172 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = Z734T5CD6B;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.1;
|
||||
MACOSX_DEPLOYMENT_TARGET = 14.7;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "pro.thelinux.Gas-ManUITests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = auto;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,7";
|
||||
TEST_TARGET_NAME = "Gas Man";
|
||||
XROS_DEPLOYMENT_TARGET = 2.1;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3D3444842D889F8000AA3172 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = Z734T5CD6B;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.1;
|
||||
MACOSX_DEPLOYMENT_TARGET = 14.7;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "pro.thelinux.Gas-ManUITests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = auto;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,7";
|
||||
TEST_TARGET_NAME = "Gas Man";
|
||||
XROS_DEPLOYMENT_TARGET = 2.1;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
3D34444B2D889F7D00AA3172 /* Build configuration list for PBXProject "Gas Man" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3D34447D2D889F8000AA3172 /* Debug */,
|
||||
3D34447E2D889F8000AA3172 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
3D34447A2D889F8000AA3172 /* Build configuration list for PBXNativeTarget "Gas Man" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3D34447B2D889F8000AA3172 /* Debug */,
|
||||
3D34447C2D889F8000AA3172 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
3D34447F2D889F8000AA3172 /* Build configuration list for PBXNativeTarget "Gas ManTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3D3444802D889F8000AA3172 /* Debug */,
|
||||
3D3444812D889F8000AA3172 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
3D3444822D889F8000AA3172 /* Build configuration list for PBXNativeTarget "Gas ManUITests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3D3444832D889F8000AA3172 /* Debug */,
|
||||
3D3444842D889F8000AA3172 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 3D3444482D889F7D00AA3172 /* Project object */;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -0,0 +1,5 @@
|
|||
<?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/>
|
||||
</plist>
|
|
@ -0,0 +1,14 @@
|
|||
<?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>BuildLocationStyle</key>
|
||||
<string>UseAppPreferences</string>
|
||||
<key>CustomBuildLocationType</key>
|
||||
<string>RelativeToDerivedData</string>
|
||||
<key>DerivedDataLocationStyle</key>
|
||||
<string>Default</string>
|
||||
<key>ShowSharedSchemesAutomaticallyEnabled</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1610"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES"
|
||||
buildArchitectures = "Automatic">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3D34444F2D889F7D00AA3172"
|
||||
BuildableName = "Gas Man.app"
|
||||
BlueprintName = "Gas Man"
|
||||
ReferencedContainer = "container:Gas Man.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
shouldAutocreateTestPlan = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO"
|
||||
parallelizable = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3D3444662D889F7F00AA3172"
|
||||
BuildableName = "Gas ManTests.xctest"
|
||||
BlueprintName = "Gas ManTests"
|
||||
ReferencedContainer = "container:Gas Man.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO"
|
||||
parallelizable = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3D3444702D889F8000AA3172"
|
||||
BuildableName = "Gas ManUITests.xctest"
|
||||
BlueprintName = "Gas ManUITests"
|
||||
ReferencedContainer = "container:Gas Man.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3D34444F2D889F7D00AA3172"
|
||||
BuildableName = "Gas Man.app"
|
||||
BlueprintName = "Gas Man"
|
||||
ReferencedContainer = "container:Gas Man.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3D34444F2D889F7D00AA3172"
|
||||
BuildableName = "Gas Man.app"
|
||||
BlueprintName = "Gas Man"
|
||||
ReferencedContainer = "container:Gas Man.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -0,0 +1,32 @@
|
|||
<?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>Gas Man.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>3D34444F2D889F7D00AA3172</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>3D3444662D889F7F00AA3172</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>3D3444702D889F8000AA3172</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,249 @@
|
|||
//
|
||||
// AddFuelLogView.swift
|
||||
// Gas Man
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import CoreData
|
||||
|
||||
struct AddFuelLogView: View {
|
||||
@Environment(\.managedObjectContext) private var viewContext
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
// Form fields
|
||||
@State private var date = Date()
|
||||
@State private var odometer = ""
|
||||
@State private var fuelVolume = ""
|
||||
@State private var cost = ""
|
||||
@State private var locationCoordinates = ""
|
||||
@State private var locationName = ""
|
||||
@State private var selectedOctane: Int = 87 // Default or from previous record
|
||||
@State private var pricePerGalon = ""
|
||||
|
||||
// Allowed octane options
|
||||
let octaneOptions = [87, 89, 91, 92, 93, 95]
|
||||
|
||||
// Location manager for automatic location updates
|
||||
@StateObject private var locationManager = LocationManager()
|
||||
|
||||
// For tracking the previous odometer reading
|
||||
@State private var previousOdometer: Double? = nil
|
||||
@State private var showOdometerAlert = false
|
||||
|
||||
// Flag to avoid update loops in our calculation logic
|
||||
@State private var isUpdatingCalculation = false
|
||||
|
||||
// Computed property for formatted previous odometer value
|
||||
private var previousOdometerString: String {
|
||||
previousOdometer.map { String(format: "%.0f", $0) } ?? "N/A"
|
||||
}
|
||||
|
||||
// Computed property for the odometer alert
|
||||
var odometerAlert: Alert {
|
||||
let messageString = "Odometer reading must be greater than the previous record (\(previousOdometerString))."
|
||||
return Alert(
|
||||
title: Text("Odometer Reading Error"),
|
||||
message: Text(messageString),
|
||||
dismissButton: .default(Text("OK"))
|
||||
)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
Form {
|
||||
fuelLogDetailsSection
|
||||
}
|
||||
.navigationTitle("Add Fuel Log")
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button("Save") { saveFuelLog() }
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
Button("Cancel") { dismiss() }
|
||||
}
|
||||
}
|
||||
.onChange(of: locationManager.location) { newLocation in
|
||||
if let loc = newLocation {
|
||||
locationCoordinates = "\(loc.coordinate.latitude), \(loc.coordinate.longitude)"
|
||||
}
|
||||
}
|
||||
.onChange(of: locationManager.placemark) { newPlacemark in
|
||||
if let placemark = newPlacemark {
|
||||
locationName = placemark.name ?? ""
|
||||
}
|
||||
}
|
||||
.onAppear(perform: loadPreviousData)
|
||||
.alert(isPresented: $showOdometerAlert) { odometerAlert }
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Subviews
|
||||
|
||||
private var fuelLogDetailsSection: some View {
|
||||
Section(header: Text("Fuel Log Details")) {
|
||||
DatePicker("Date", selection: $date, displayedComponents: [.date, .hourAndMinute])
|
||||
|
||||
// Odometer field
|
||||
HStack(spacing: 4) {
|
||||
Text("Odometer: ")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
TextField("", text: $odometer)
|
||||
.keyboardType(.decimalPad)
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
}
|
||||
|
||||
// Fuel Volume field
|
||||
HStack(spacing: 4) {
|
||||
Text("Gallons: ")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
TextField("", text: $fuelVolume)
|
||||
.keyboardType(.decimalPad)
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
.onChange(of: fuelVolume) { _ in updateCalculatedValues() }
|
||||
}
|
||||
|
||||
// Price per Gallon field
|
||||
HStack(spacing: 4) {
|
||||
Text("Price/Gal: $")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
TextField("", text: $pricePerGalon)
|
||||
.keyboardType(.decimalPad)
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
.onChange(of: pricePerGalon) { _ in updateCalculatedValues() }
|
||||
}
|
||||
|
||||
// Cost field
|
||||
HStack(spacing: 4) {
|
||||
Text("Cost: $")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
TextField("", text: $cost)
|
||||
.keyboardType(.decimalPad)
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
.onChange(of: cost) { _ in updateCalculatedValues() }
|
||||
}
|
||||
|
||||
Button("Get Current Location") {
|
||||
locationManager.requestLocation()
|
||||
}
|
||||
|
||||
if !locationCoordinates.isEmpty {
|
||||
Text("Coordinates: \(locationCoordinates)")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
||||
TextField("Location Coordinates", text: $locationCoordinates)
|
||||
|
||||
HStack(spacing: 4) {
|
||||
Text("Location Name:")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
TextField("", text: $locationName)
|
||||
}
|
||||
|
||||
Picker("Octane", selection: $selectedOctane) {
|
||||
ForEach(octaneOptions, id: \.self) { option in
|
||||
Text("\(option)").tag(option)
|
||||
}
|
||||
}
|
||||
.pickerStyle(MenuPickerStyle())
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Helper Methods
|
||||
|
||||
private func loadPreviousData() {
|
||||
let fetchRequest: NSFetchRequest<FuelLog> = FuelLog.fetchRequest()
|
||||
fetchRequest.sortDescriptors = [NSSortDescriptor(key: "date", ascending: false)]
|
||||
fetchRequest.fetchLimit = 1
|
||||
if let lastFuelLog = try? viewContext.fetch(fetchRequest).first {
|
||||
selectedOctane = Int(lastFuelLog.octane)
|
||||
previousOdometer = lastFuelLog.odometer
|
||||
odometer = String(format: "%.0f", lastFuelLog.odometer)
|
||||
} else {
|
||||
selectedOctane = 87
|
||||
odometer = ""
|
||||
}
|
||||
}
|
||||
|
||||
private func roundToThree(_ value: Double) -> Double {
|
||||
return (value * 1000).rounded() / 1000
|
||||
}
|
||||
|
||||
private func roundToTwo(_ value: Double) -> Double {
|
||||
return (value * 100).rounded() / 100
|
||||
}
|
||||
|
||||
private func updateCalculatedValues() {
|
||||
// Prevent recursive updates.
|
||||
guard !isUpdatingCalculation else { return }
|
||||
isUpdatingCalculation = true
|
||||
|
||||
let fuel = Double(fuelVolume)
|
||||
let costVal = Double(cost)
|
||||
let price = Double(pricePerGalon)
|
||||
|
||||
// 1. If fuelVolume and pricePerGalon are provided, calculate cost.
|
||||
if let f = fuel, let p = price, f > 0 {
|
||||
let computedCost = roundToTwo(f * p)
|
||||
let computedCostStr = String(format: "%.2f", computedCost)
|
||||
if cost != computedCostStr {
|
||||
cost = computedCostStr
|
||||
}
|
||||
}
|
||||
// 2. If fuelVolume and cost are provided, and pricePerGalon is empty, calculate pricePerGalon.
|
||||
else if let f = fuel, let c = costVal, f > 0, pricePerGalon.trimmingCharacters(in: .whitespaces).isEmpty {
|
||||
let computedPrice = roundToThree(c / f)
|
||||
let computedPriceStr = String(format: "%.3f", computedPrice)
|
||||
if pricePerGalon != computedPriceStr {
|
||||
pricePerGalon = computedPriceStr
|
||||
}
|
||||
}
|
||||
// 3. If pricePerGalon and cost are provided, and fuelVolume is empty, calculate fuelVolume.
|
||||
else if let p = price, let c = costVal, p > 0, fuelVolume.trimmingCharacters(in: .whitespaces).isEmpty {
|
||||
let computedFuel = roundToThree(c / p)
|
||||
let computedFuelStr = String(format: "%.3f", computedFuel)
|
||||
if fuelVolume != computedFuelStr {
|
||||
fuelVolume = computedFuelStr
|
||||
}
|
||||
}
|
||||
|
||||
isUpdatingCalculation = false
|
||||
}
|
||||
|
||||
private func saveFuelLog() {
|
||||
guard let newOdometer = Double(odometer) else {
|
||||
return
|
||||
}
|
||||
// Validate that the new odometer reading is greater than the previous record
|
||||
if let previous = previousOdometer, newOdometer <= previous {
|
||||
showOdometerAlert = true
|
||||
return
|
||||
}
|
||||
|
||||
let newLog = FuelLog(context: viewContext)
|
||||
newLog.id = UUID()
|
||||
newLog.date = date
|
||||
newLog.odometer = newOdometer
|
||||
newLog.fuelVolume = Double(fuelVolume) ?? 0
|
||||
newLog.cost = Double(cost) ?? 0
|
||||
newLog.locationCoordinates = locationCoordinates
|
||||
newLog.locationName = locationName
|
||||
newLog.octane = Int16(selectedOctane)
|
||||
newLog.pricePerGalon = Double(pricePerGalon) ?? 0
|
||||
|
||||
do {
|
||||
try viewContext.save()
|
||||
dismiss()
|
||||
} catch {
|
||||
let nsError = error as NSError
|
||||
fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
//
|
||||
// AddMaintenanceView.swift
|
||||
// Gas Man
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct AddMaintenanceView: View {
|
||||
@Environment(\.managedObjectContext) private var viewContext
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
@State private var date = Date()
|
||||
@State private var odometer = ""
|
||||
@State private var eventType = ""
|
||||
@State private var cost = ""
|
||||
@State private var notes = ""
|
||||
@State private var locationCoordinates = ""
|
||||
@State private var locationName = ""
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
Form {
|
||||
Section(header: Text("Maintenance Details")) {
|
||||
DatePicker("Date", selection: $date, displayedComponents: [.date, .hourAndMinute])
|
||||
TextField("Odometer Reading", text: $odometer)
|
||||
.keyboardType(.decimalPad)
|
||||
TextField("Service Type", text: $eventType)
|
||||
TextField("Cost ($)", text: $cost)
|
||||
.keyboardType(.decimalPad)
|
||||
TextField("Notes", text: $notes)
|
||||
TextField("Location Coordinates", text: $locationCoordinates)
|
||||
TextField("Location Name", text: $locationName)
|
||||
}
|
||||
}
|
||||
.navigationTitle("Add Maintenance")
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button("Save") {
|
||||
saveMaintenance()
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
Button("Cancel") {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func saveMaintenance() {
|
||||
let newEvent = MaintenanceEvent(context: viewContext)
|
||||
newEvent.id = UUID()
|
||||
newEvent.date = date
|
||||
newEvent.odometer = Double(odometer) ?? 0
|
||||
newEvent.eventType = eventType
|
||||
newEvent.cost = Double(cost) ?? 0
|
||||
newEvent.notes = notes
|
||||
newEvent.locationCoordinates = locationCoordinates
|
||||
newEvent.locationName = locationName
|
||||
|
||||
do {
|
||||
try viewContext.save()
|
||||
dismiss()
|
||||
} catch {
|
||||
let nsError = error as NSError
|
||||
fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "tinted"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "16x16"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "16x16"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "32x32"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "32x32"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "128x128"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "128x128"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "256x256"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "256x256"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "512x512"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "512x512"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
//
|
||||
// ContentView.swift
|
||||
// Gas Man
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
//import CoreData
|
||||
//
|
||||
//struct ContentView: View {
|
||||
// @Environment(\.managedObjectContext) private var viewContext
|
||||
//
|
||||
// @FetchRequest(
|
||||
// sortDescriptors: [NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)],
|
||||
// animation: .default)
|
||||
// private var items: FetchedResults<Item>
|
||||
//
|
||||
// var body: some View {
|
||||
// NavigationView {
|
||||
// List {
|
||||
// ForEach(items) { item in
|
||||
// NavigationLink {
|
||||
// Text("Item at \(item.timestamp!, formatter: itemFormatter)")
|
||||
// } label: {
|
||||
// Text(item.timestamp!, formatter: itemFormatter)
|
||||
// }
|
||||
// }
|
||||
// .onDelete(perform: deleteItems)
|
||||
// }
|
||||
// .toolbar {
|
||||
//#if os(iOS)
|
||||
// ToolbarItem(placement: .navigationBarTrailing) {
|
||||
// EditButton()
|
||||
// }
|
||||
//#endif
|
||||
// ToolbarItem {
|
||||
// Button(action: addItem) {
|
||||
// Label("Add Item", systemImage: "plus")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Text("Select an item")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private func addItem() {
|
||||
// withAnimation {
|
||||
// let newItem = Item(context: viewContext)
|
||||
// newItem.timestamp = Date()
|
||||
//
|
||||
// do {
|
||||
// try viewContext.save()
|
||||
// } catch {
|
||||
// // Replace this implementation with code to handle the error appropriately.
|
||||
// // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
|
||||
// let nsError = error as NSError
|
||||
// fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private func deleteItems(offsets: IndexSet) {
|
||||
// withAnimation {
|
||||
// offsets.map { items[$0] }.forEach(viewContext.delete)
|
||||
//
|
||||
// do {
|
||||
// try viewContext.save()
|
||||
// } catch {
|
||||
// // Replace this implementation with code to handle the error appropriately.
|
||||
// // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
|
||||
// let nsError = error as NSError
|
||||
// fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//private let itemFormatter: DateFormatter = {
|
||||
// let formatter = DateFormatter()
|
||||
// formatter.dateStyle = .short
|
||||
// formatter.timeStyle = .medium
|
||||
// return formatter
|
||||
//}()
|
||||
|
||||
//#Preview {
|
||||
// ContentView().environment(\.managedObjectContext, PersistenceController.preview.container.viewContext)
|
||||
//}
|
|
@ -0,0 +1,74 @@
|
|||
//
|
||||
// FuelLogDetailView.swift
|
||||
// Gas Man
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
private let dateFormatter: DateFormatter = {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateStyle = .short
|
||||
formatter.timeStyle = .short
|
||||
return formatter
|
||||
}()
|
||||
|
||||
|
||||
struct FuelLogDetailView: View {
|
||||
var fuelLog: FuelLog
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
Section(header: Text("Basic Information")) {
|
||||
HStack {
|
||||
Text("Date:")
|
||||
Spacer()
|
||||
Text(fuelLog.date ?? Date(), formatter: dateFormatter)
|
||||
}
|
||||
HStack {
|
||||
Text("Odometer:")
|
||||
Spacer()
|
||||
Text("\(fuelLog.odometer, specifier: "%.0f") miles")
|
||||
}
|
||||
}
|
||||
Section(header: Text("Fuel Information")) {
|
||||
HStack {
|
||||
Text("Fuel Volume:")
|
||||
Spacer()
|
||||
Text("\(fuelLog.fuelVolume, specifier: "%.3f") gallons")
|
||||
}
|
||||
HStack {
|
||||
Text("Cost:")
|
||||
Spacer()
|
||||
Text("$\(fuelLog.cost, specifier: "%.2f")")
|
||||
}
|
||||
HStack {
|
||||
Text("Price per Gallon:")
|
||||
Spacer()
|
||||
Text("$\(fuelLog.pricePerGalon, specifier: "%.3f")")
|
||||
}
|
||||
}
|
||||
Section(header: Text("Location")) {
|
||||
HStack {
|
||||
Text("Coordinates:")
|
||||
Spacer()
|
||||
Text(fuelLog.locationCoordinates ?? "N/A")
|
||||
}
|
||||
HStack {
|
||||
Text("Location Name:")
|
||||
Spacer()
|
||||
Text(fuelLog.locationName ?? "N/A")
|
||||
}
|
||||
}
|
||||
Section(header: Text("Fuel Details")) {
|
||||
HStack {
|
||||
Text("Octane:")
|
||||
Spacer()
|
||||
Text("\(fuelLog.octane)")
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("Fuel Log Detail")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
//
|
||||
// FuelLogListView.swift
|
||||
// Gas Man
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
|
||||
import SwiftUI
|
||||
import CoreData
|
||||
|
||||
struct FuelLogListView: View {
|
||||
@Environment(\.managedObjectContext) private var viewContext
|
||||
@FetchRequest(
|
||||
sortDescriptors: [NSSortDescriptor(keyPath: \FuelLog.date, ascending: false)],
|
||||
animation: .default)
|
||||
private var fuelLogs: FetchedResults<FuelLog>
|
||||
|
||||
@State private var showingAddFuelLog = false // Controls sheet presentation
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
List {
|
||||
ForEach(Array(fuelLogs.enumerated()), id: \.element) { index, log in
|
||||
// Compute distance since the previous record:
|
||||
let distance: Double? = {
|
||||
if index < fuelLogs.count - 1 {
|
||||
let previousLog = fuelLogs[index + 1]
|
||||
let milesDriven = log.odometer - previousLog.odometer
|
||||
return milesDriven > 0 ? milesDriven : nil
|
||||
}
|
||||
return nil
|
||||
}()
|
||||
|
||||
// Compute MPG (if possible)
|
||||
let mpg: Double? = {
|
||||
if index < fuelLogs.count - 1 {
|
||||
let previousLog = fuelLogs[index + 1]
|
||||
let milesDriven = log.odometer - previousLog.odometer
|
||||
if log.fuelVolume > 0 && milesDriven > 0 {
|
||||
return milesDriven / log.fuelVolume
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}()
|
||||
|
||||
NavigationLink(destination: FuelLogDetailView(fuelLog: log)) {
|
||||
FuelLogSummaryView(log: log, mpg: mpg, distanceSincePrevious: distance)
|
||||
}
|
||||
}
|
||||
.onDelete(perform: deleteFuelLogs)
|
||||
}
|
||||
.listStyle(InsetGroupedListStyle())
|
||||
.navigationTitle("Fuel Logs")
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button(action: {
|
||||
showingAddFuelLog = true // Present AddFuelLogView
|
||||
}) {
|
||||
Label("Add Fuel Log", systemImage: "plus")
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
EditButton()
|
||||
}
|
||||
}
|
||||
// Sheet presentation for AddFuelLogView
|
||||
.sheet(isPresented: $showingAddFuelLog) {
|
||||
AddFuelLogView().environment(\.managedObjectContext, viewContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func deleteFuelLogs(offsets: IndexSet) {
|
||||
withAnimation {
|
||||
offsets.map { fuelLogs[$0] }.forEach(viewContext.delete)
|
||||
do {
|
||||
try viewContext.save()
|
||||
} catch {
|
||||
let nsError = error as NSError
|
||||
fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
//
|
||||
// FuelLogSummaryView.swift
|
||||
// Gas Man
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
|
||||
import SwiftUI
|
||||
|
||||
private let dateFormatter: DateFormatter = {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateStyle = .short
|
||||
formatter.timeStyle = .short
|
||||
return formatter
|
||||
}()
|
||||
|
||||
struct FuelLogSummaryView: View {
|
||||
var log: FuelLog
|
||||
var mpg: Double?
|
||||
var distanceSincePrevious: Double?
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
// Row 1: Date and MPG (if available)
|
||||
HStack {
|
||||
Text(log.date ?? Date(), formatter: dateFormatter)
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.primary)
|
||||
Spacer()
|
||||
if let mpg = mpg {
|
||||
Text("MPG: \(mpg, specifier: "%.3f")")
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
Divider()
|
||||
// Row 2: Distance (instead of odometer) and Fuel Volume
|
||||
HStack {
|
||||
VStack(alignment: .leading) {
|
||||
Text("Distance")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
if let distance = distanceSincePrevious {
|
||||
Text("\(distance, specifier: "%.0f") miles")
|
||||
.bold()
|
||||
} else {
|
||||
Text("N/A")
|
||||
.bold()
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
VStack(alignment: .leading) {
|
||||
Text("Fuel")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
Text("\(log.fuelVolume, specifier: "%.3f") gal")
|
||||
.bold()
|
||||
}
|
||||
}
|
||||
// Row 3: Cost and Price per Gallon
|
||||
HStack {
|
||||
VStack(alignment: .leading) {
|
||||
Text("Cost")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
Text("$\(log.cost, specifier: "%.2f")")
|
||||
.bold()
|
||||
}
|
||||
Spacer()
|
||||
VStack(alignment: .leading) {
|
||||
Text("Price/Gal")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
Text("$\(log.pricePerGalon, specifier: "%.3f")")
|
||||
.bold()
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(8)
|
||||
.background(Color(.secondarySystemBackground))
|
||||
.cornerRadius(8)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?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>aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.developer.aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.developer.icloud-container-identifiers</key>
|
||||
<array/>
|
||||
<key>com.apple.developer.icloud-services</key>
|
||||
<array>
|
||||
<string>CloudKit</string>
|
||||
</array>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-write</key>
|
||||
<true/>
|
||||
<key>com.apple.security.personal-information.location</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,8 @@
|
|||
<?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>_XCCurrentVersionName</key>
|
||||
<string>Gas_Man.xcdatamodel</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="23507" systemVersion="23H222" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithCloudKit="YES" userDefinedModelVersionIdentifier="">
|
||||
<entity name="FuelLog" representedClassName="FuelLog" isAbstract="YES" syncable="YES" codeGenerationType="class">
|
||||
<attribute name="cost" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
|
||||
<attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
||||
<attribute name="fuelVolume" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
|
||||
<attribute name="id" optional="YES" attributeType="UUID" usesScalarValueType="NO"/>
|
||||
<attribute name="locationCoordinates" optional="YES" attributeType="String"/>
|
||||
<attribute name="locationName" optional="YES" attributeType="String"/>
|
||||
<attribute name="octane" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="odometer" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
|
||||
<attribute name="pricePerGalon" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
|
||||
</entity>
|
||||
<entity name="Item" representedClassName="Item" syncable="YES" codeGenerationType="class"/>
|
||||
<entity name="MaintenanceEvent" representedClassName="MaintenanceEvent" isAbstract="YES" syncable="YES" codeGenerationType="class">
|
||||
<attribute name="cost" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
|
||||
<attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
||||
<attribute name="eventType" optional="YES" attributeType="String"/>
|
||||
<attribute name="id" optional="YES" attributeType="UUID" usesScalarValueType="NO"/>
|
||||
<attribute name="locationCoordinates" optional="YES" attributeType="String"/>
|
||||
<attribute name="locationName" optional="YES" attributeType="String"/>
|
||||
<attribute name="notes" optional="YES" attributeType="String"/>
|
||||
<attribute name="odometer" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
|
||||
</entity>
|
||||
</model>
|
|
@ -0,0 +1,21 @@
|
|||
//
|
||||
// Gas_ManApp.swift
|
||||
// Gas Man
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct Gas_ManApp: App {
|
||||
let persistenceController = PersistenceController.shared
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
MainTabView() // Replace with your actual view name.
|
||||
.environment(\.managedObjectContext, persistenceController.container.viewContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?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>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>This app needs your location to automatically fill in location details for fuel and maintenance logs</string>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,55 @@
|
|||
//
|
||||
// LocationManager.swift
|
||||
// Gas Man
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
|
||||
import Foundation
|
||||
import CoreLocation
|
||||
import Combine
|
||||
|
||||
class LocationManager: NSObject, ObservableObject, CLLocationManagerDelegate {
|
||||
private let manager = CLLocationManager()
|
||||
|
||||
@Published var location: CLLocation?
|
||||
@Published var placemark: CLPlacemark?
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
manager.delegate = self
|
||||
manager.desiredAccuracy = kCLLocationAccuracyBest
|
||||
}
|
||||
|
||||
func requestLocation() {
|
||||
manager.requestWhenInUseAuthorization()
|
||||
manager.requestLocation()
|
||||
}
|
||||
|
||||
// CLLocationManagerDelegate
|
||||
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
|
||||
if let loc = locations.first {
|
||||
DispatchQueue.main.async {
|
||||
self.location = loc
|
||||
}
|
||||
// Reverse geocode
|
||||
let geocoder = CLGeocoder()
|
||||
geocoder.reverseGeocodeLocation(loc) { [weak self] placemarks, error in
|
||||
if let error = error {
|
||||
print("Reverse geocode error: \(error)")
|
||||
return
|
||||
}
|
||||
if let firstPlacemark = placemarks?.first {
|
||||
DispatchQueue.main.async {
|
||||
self?.placemark = firstPlacemark
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
|
||||
print("Failed to get user location: \(error)")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// MainTabView.swift
|
||||
// Gas Man
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct MainTabView: View {
|
||||
var body: some View {
|
||||
TabView {
|
||||
FuelLogListView()
|
||||
.tabItem {
|
||||
Label("Fuel", systemImage: "fuelpump.fill")
|
||||
}
|
||||
MaintenanceListView()
|
||||
.tabItem {
|
||||
Label("Maintenance", systemImage: "wrench.fill")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
//
|
||||
// MaintenanceListView.swift
|
||||
// Gas Man
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
|
||||
import SwiftUI
|
||||
import CoreData
|
||||
|
||||
struct MaintenanceListView: View {
|
||||
@Environment(\.managedObjectContext) private var viewContext
|
||||
@FetchRequest(
|
||||
sortDescriptors: [NSSortDescriptor(keyPath: \MaintenanceEvent.date, ascending: false)],
|
||||
animation: .default)
|
||||
private var maintenanceEvents: FetchedResults<MaintenanceEvent>
|
||||
|
||||
@State private var showingAddMaintenance = false
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
List {
|
||||
ForEach(maintenanceEvents) { event in
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text("Date: \(event.date ?? Date(), formatter: dateFormatter)")
|
||||
Text("Odometer: \(event.odometer, specifier: "%.0f") miles")
|
||||
Text("Type: \(event.eventType)")
|
||||
Text("Cost: $\(event.cost, specifier: "%.2f")")
|
||||
if let notes = event.notes, !notes.isEmpty {
|
||||
Text("Notes: \(notes)")
|
||||
}
|
||||
if let locationName = event.locationName, !locationName.isEmpty {
|
||||
Text("Location: \(locationName)")
|
||||
}
|
||||
if let locationCoordinates = event.locationCoordinates, !locationCoordinates.isEmpty {
|
||||
Text("Coordinates: \(locationCoordinates)")
|
||||
}
|
||||
}
|
||||
}
|
||||
.onDelete(perform: deleteMaintenance)
|
||||
}
|
||||
.navigationTitle("Maintenance")
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button(action: { showingAddMaintenance.toggle() }) {
|
||||
Label("Add Maintenance", systemImage: "plus")
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
EditButton()
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showingAddMaintenance) {
|
||||
AddMaintenanceView().environment(\.managedObjectContext, viewContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func deleteMaintenance(offsets: IndexSet) {
|
||||
withAnimation {
|
||||
offsets.map { maintenanceEvents[$0] }.forEach(viewContext.delete)
|
||||
do {
|
||||
try viewContext.save()
|
||||
} catch {
|
||||
let nsError = error as NSError
|
||||
fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private let dateFormatter: DateFormatter = {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateStyle = .short
|
||||
formatter.timeStyle = .short
|
||||
return formatter
|
||||
}()
|
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// Persistence.swift
|
||||
// Gas Man
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
import CoreData
|
||||
|
||||
struct PersistenceController {
|
||||
static let shared = PersistenceController()
|
||||
|
||||
let container: NSPersistentCloudKitContainer
|
||||
|
||||
init(inMemory: Bool = false) {
|
||||
// "GasMan" must match the name of your .xcdatamodeld file.
|
||||
container = NSPersistentCloudKitContainer(name: "Gas_Man")
|
||||
|
||||
if inMemory {
|
||||
container.persistentStoreDescriptions.first?.url = URL(fileURLWithPath: "/dev/null")
|
||||
}
|
||||
|
||||
// Enable CloudKit options if necessary
|
||||
guard let description = container.persistentStoreDescriptions.first else {
|
||||
fatalError("No persistent store description found.")
|
||||
}
|
||||
description.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)
|
||||
description.cloudKitContainerOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: "iCloud.com.pro.thelinux.GasMan") // Update with your container ID
|
||||
|
||||
container.loadPersistentStores { storeDescription, error in
|
||||
if let error = error as NSError? {
|
||||
fatalError("Unresolved error \(error), \(error.userInfo)")
|
||||
}
|
||||
}
|
||||
|
||||
// Automatically merge changes from iCloud
|
||||
container.viewContext.automaticallyMergesChangesFromParent = true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// Gas_ManTests.swift
|
||||
// Gas ManTests
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
final class Gas_ManTests: XCTestCase {
|
||||
|
||||
override func setUpWithError() throws {
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
func testExample() throws {
|
||||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
// Any test you write for XCTest can be annotated as throws and async.
|
||||
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
|
||||
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
|
||||
}
|
||||
|
||||
func testPerformanceExample() throws {
|
||||
// This is an example of a performance test case.
|
||||
measure {
|
||||
// Put the code you want to measure the time of here.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
//
|
||||
// Gas_ManUITests.swift
|
||||
// Gas ManUITests
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
final class Gas_ManUITests: XCTestCase {
|
||||
|
||||
override func setUpWithError() throws {
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
|
||||
// In UI tests it is usually best to stop immediately when a failure occurs.
|
||||
continueAfterFailure = false
|
||||
|
||||
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testExample() throws {
|
||||
// UI tests must launch the application that they test.
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testLaunchPerformance() throws {
|
||||
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
|
||||
// This measures how long it takes to launch your application.
|
||||
measure(metrics: [XCTApplicationLaunchMetric()]) {
|
||||
XCUIApplication().launch()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
//
|
||||
// Gas_ManUITestsLaunchTests.swift
|
||||
// Gas ManUITests
|
||||
//
|
||||
// Created by Kameron Kenny on 3/17/25.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
final class Gas_ManUITestsLaunchTests: XCTestCase {
|
||||
|
||||
override class var runsForEachTargetApplicationUIConfiguration: Bool {
|
||||
true
|
||||
}
|
||||
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testLaunch() throws {
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
|
||||
// Insert steps here to perform after app launch but before taking a screenshot,
|
||||
// such as logging into a test account or navigating somewhere in the app
|
||||
|
||||
let attachment = XCTAttachment(screenshot: app.screenshot())
|
||||
attachment.name = "Launch Screen"
|
||||
attachment.lifetime = .keepAlways
|
||||
add(attachment)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue