diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..939a874 Binary files /dev/null and b/.DS_Store differ diff --git a/shopAp/shopAp.xcodeproj/project.pbxproj b/shopAp/shopAp.xcodeproj/project.pbxproj new file mode 100644 index 0000000..e8f9974 --- /dev/null +++ b/shopAp/shopAp.xcodeproj/project.pbxproj @@ -0,0 +1,435 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + FA001BF02721400700779FF7 /* addNewProduct.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA001BEF2721400700779FF7 /* addNewProduct.swift */; }; + FA271E2E2722C7E700E964CF /* EditProduct.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA271E2D2722C7E700E964CF /* EditProduct.swift */; }; + FA271E322722E5F100E964CF /* updateCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA271E312722E5F100E964CF /* updateCell.swift */; }; + FA271E342722EBCA00E964CF /* updatePage.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA271E332722EBCA00E964CF /* updatePage.swift */; }; + FA630B7827206C5100744115 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA630B7727206C5100744115 /* AppDelegate.swift */; }; + FA630B7A27206C5100744115 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA630B7927206C5100744115 /* SceneDelegate.swift */; }; + FA630B7C27206C5100744115 /* storeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA630B7B27206C5100744115 /* storeVC.swift */; }; + FA630B7F27206C5100744115 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA630B7D27206C5100744115 /* Main.storyboard */; }; + FA630B8127206C5300744115 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FA630B8027206C5300744115 /* Assets.xcassets */; }; + FA630B8427206C5300744115 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA630B8227206C5300744115 /* LaunchScreen.storyboard */; }; + FA630B8C27206C7000744115 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA630B8B27206C7000744115 /* Model.swift */; }; + FA630B8E2720704100744115 /* productCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA630B8D2720704100744115 /* productCell.swift */; }; + FA630B9027207E2B00744115 /* cartVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA630B8F27207E2B00744115 /* cartVC.swift */; }; + FA630B92272081D400744115 /* cartCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA630B91272081D400744115 /* cartCell.swift */; }; + FA630B982720930E00744115 /* productVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA630B972720930E00744115 /* productVC.swift */; }; + FA630B9A2720A1F700744115 /* purchaseVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA630B992720A1F700744115 /* purchaseVC.swift */; }; + FAE2E5632721E43C005D83CA /* deleteProduct.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE2E5622721E43C005D83CA /* deleteProduct.swift */; }; + FAE2E5652721E632005D83CA /* deleteCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE2E5642721E632005D83CA /* deleteCell.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + FA001BEF2721400700779FF7 /* addNewProduct.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = addNewProduct.swift; sourceTree = ""; }; + FA271E2D2722C7E700E964CF /* EditProduct.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditProduct.swift; sourceTree = ""; }; + FA271E312722E5F100E964CF /* updateCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = updateCell.swift; sourceTree = ""; }; + FA271E332722EBCA00E964CF /* updatePage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = updatePage.swift; sourceTree = ""; }; + FA630B7427206C5100744115 /* shopAp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = shopAp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + FA630B7727206C5100744115 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + FA630B7927206C5100744115 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + FA630B7B27206C5100744115 /* storeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = storeVC.swift; sourceTree = ""; }; + FA630B7E27206C5100744115 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + FA630B8027206C5300744115 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + FA630B8327206C5300744115 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + FA630B8527206C5300744115 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + FA630B8B27206C7000744115 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = ""; }; + FA630B8D2720704100744115 /* productCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = productCell.swift; sourceTree = ""; }; + FA630B8F27207E2B00744115 /* cartVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = cartVC.swift; sourceTree = ""; }; + FA630B91272081D400744115 /* cartCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = cartCell.swift; sourceTree = ""; }; + FA630B972720930E00744115 /* productVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = productVC.swift; sourceTree = ""; }; + FA630B992720A1F700744115 /* purchaseVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = purchaseVC.swift; sourceTree = ""; }; + FAE2E5622721E43C005D83CA /* deleteProduct.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = deleteProduct.swift; sourceTree = ""; }; + FAE2E5642721E632005D83CA /* deleteCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = deleteCell.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + FA630B7127206C5100744115 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + FA630B6B27206C5100744115 = { + isa = PBXGroup; + children = ( + FA630B7627206C5100744115 /* shopAp */, + FA630B7527206C5100744115 /* Products */, + ); + sourceTree = ""; + }; + FA630B7527206C5100744115 /* Products */ = { + isa = PBXGroup; + children = ( + FA630B7427206C5100744115 /* shopAp.app */, + ); + name = Products; + sourceTree = ""; + }; + FA630B7627206C5100744115 /* shopAp */ = { + isa = PBXGroup; + children = ( + FA630B7727206C5100744115 /* AppDelegate.swift */, + FA630B7927206C5100744115 /* SceneDelegate.swift */, + FA630B8B27206C7000744115 /* Model.swift */, + FAE2E5622721E43C005D83CA /* deleteProduct.swift */, + FAE2E5642721E632005D83CA /* deleteCell.swift */, + FA630B7D27206C5100744115 /* Main.storyboard */, + FA271E332722EBCA00E964CF /* updatePage.swift */, + FA271E2D2722C7E700E964CF /* EditProduct.swift */, + FA271E312722E5F100E964CF /* updateCell.swift */, + FA001BEF2721400700779FF7 /* addNewProduct.swift */, + FA630B992720A1F700744115 /* purchaseVC.swift */, + FA630B95272092C900744115 /* Product Page */, + FA630B96272092D700744115 /* cart Page */, + FA630B942720927300744115 /* store Page */, + FA630B8027206C5300744115 /* Assets.xcassets */, + FA630B8227206C5300744115 /* LaunchScreen.storyboard */, + FA630B8527206C5300744115 /* Info.plist */, + ); + path = shopAp; + sourceTree = ""; + }; + FA630B942720927300744115 /* store Page */ = { + isa = PBXGroup; + children = ( + FA630B7B27206C5100744115 /* storeVC.swift */, + FA630B8D2720704100744115 /* productCell.swift */, + ); + path = "store Page"; + sourceTree = ""; + }; + FA630B95272092C900744115 /* Product Page */ = { + isa = PBXGroup; + children = ( + FA630B972720930E00744115 /* productVC.swift */, + ); + path = "Product Page"; + sourceTree = ""; + }; + FA630B96272092D700744115 /* cart Page */ = { + isa = PBXGroup; + children = ( + FA630B8F27207E2B00744115 /* cartVC.swift */, + FA630B91272081D400744115 /* cartCell.swift */, + ); + path = "cart Page"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + FA630B7327206C5100744115 /* shopAp */ = { + isa = PBXNativeTarget; + buildConfigurationList = FA630B8827206C5300744115 /* Build configuration list for PBXNativeTarget "shopAp" */; + buildPhases = ( + FA630B7027206C5100744115 /* Sources */, + FA630B7127206C5100744115 /* Frameworks */, + FA630B7227206C5100744115 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = shopAp; + productName = shopAp; + productReference = FA630B7427206C5100744115 /* shopAp.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + FA630B6C27206C5100744115 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1300; + LastUpgradeCheck = 1300; + TargetAttributes = { + FA630B7327206C5100744115 = { + CreatedOnToolsVersion = 13.0; + }; + }; + }; + buildConfigurationList = FA630B6F27206C5100744115 /* Build configuration list for PBXProject "shopAp" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = FA630B6B27206C5100744115; + productRefGroup = FA630B7527206C5100744115 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + FA630B7327206C5100744115 /* shopAp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + FA630B7227206C5100744115 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FA630B8427206C5300744115 /* LaunchScreen.storyboard in Resources */, + FA630B8127206C5300744115 /* Assets.xcassets in Resources */, + FA630B7F27206C5100744115 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + FA630B7027206C5100744115 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FA001BF02721400700779FF7 /* addNewProduct.swift in Sources */, + FA630B9027207E2B00744115 /* cartVC.swift in Sources */, + FA271E322722E5F100E964CF /* updateCell.swift in Sources */, + FAE2E5652721E632005D83CA /* deleteCell.swift in Sources */, + FA630B7C27206C5100744115 /* storeVC.swift in Sources */, + FA630B92272081D400744115 /* cartCell.swift in Sources */, + FA630B7827206C5100744115 /* AppDelegate.swift in Sources */, + FA271E342722EBCA00E964CF /* updatePage.swift in Sources */, + FA271E2E2722C7E700E964CF /* EditProduct.swift in Sources */, + FA630B982720930E00744115 /* productVC.swift in Sources */, + FAE2E5632721E43C005D83CA /* deleteProduct.swift in Sources */, + FA630B8E2720704100744115 /* productCell.swift in Sources */, + FA630B7A27206C5100744115 /* SceneDelegate.swift in Sources */, + FA630B9A2720A1F700744115 /* purchaseVC.swift in Sources */, + FA630B8C27206C7000744115 /* Model.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + FA630B7D27206C5100744115 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + FA630B7E27206C5100744115 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + FA630B8227206C5300744115 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + FA630B8327206C5300744115 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + FA630B8627206C5300744115 /* 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++17"; + CLANG_CXX_LIBRARY = "libc++"; + 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 = 15.0; + 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; + }; + FA630B8727206C5300744115 /* 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++17"; + CLANG_CXX_LIBRARY = "libc++"; + 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 = 15.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + FA630B8927206C5300744115 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = shopAp/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + 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 = l.shopAp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + FA630B8A27206C5300744115 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = shopAp/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + 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 = l.shopAp; + 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 */ + FA630B6F27206C5100744115 /* Build configuration list for PBXProject "shopAp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA630B8627206C5300744115 /* Debug */, + FA630B8727206C5300744115 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FA630B8827206C5300744115 /* Build configuration list for PBXNativeTarget "shopAp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA630B8927206C5300744115 /* Debug */, + FA630B8A27206C5300744115 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = FA630B6C27206C5100744115 /* Project object */; +} diff --git a/shopAp/shopAp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/shopAp/shopAp.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/shopAp/shopAp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/shopAp/shopAp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/shopAp/shopAp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/shopAp/shopAp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/shopAp/shopAp.xcodeproj/project.xcworkspace/xcuserdata/macbook.xcuserdatad/UserInterfaceState.xcuserstate b/shopAp/shopAp.xcodeproj/project.xcworkspace/xcuserdata/macbook.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..1aad639 Binary files /dev/null and b/shopAp/shopAp.xcodeproj/project.xcworkspace/xcuserdata/macbook.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/shopAp/shopAp.xcodeproj/xcuserdata/macbook.xcuserdatad/xcschemes/xcschememanagement.plist b/shopAp/shopAp.xcodeproj/xcuserdata/macbook.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..971aac7 --- /dev/null +++ b/shopAp/shopAp.xcodeproj/xcuserdata/macbook.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + shopAp.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/shopAp/shopAp/AppDelegate.swift b/shopAp/shopAp/AppDelegate.swift new file mode 100644 index 0000000..2638693 --- /dev/null +++ b/shopAp/shopAp/AppDelegate.swift @@ -0,0 +1,36 @@ +// +// AppDelegate.swift +// shopAp +// +// Created by MacBook on 14/03/1443 AH. +// + +import UIKit + +@main +class AppDelegate: UIResponder, UIApplicationDelegate { + + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + // MARK: UISceneSession Lifecycle + + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + } + + +} + diff --git a/shopAp/shopAp/Assets.xcassets/AccentColor.colorset/Contents.json b/shopAp/shopAp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/AppIcon.appiconset/Contents.json b/shopAp/shopAp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/Contents.json b/shopAp/shopAp/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/p1.imageset/Contents.json b/shopAp/shopAp/Assets.xcassets/p1.imageset/Contents.json new file mode 100644 index 0000000..285389a --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/p1.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "p1.JPG", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/p1.imageset/p1.JPG b/shopAp/shopAp/Assets.xcassets/p1.imageset/p1.JPG new file mode 100644 index 0000000..ebfd2f5 Binary files /dev/null and b/shopAp/shopAp/Assets.xcassets/p1.imageset/p1.JPG differ diff --git a/shopAp/shopAp/Assets.xcassets/p11.imageset/Contents.json b/shopAp/shopAp/Assets.xcassets/p11.imageset/Contents.json new file mode 100644 index 0000000..d60b97d --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/p11.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "p11.JPG", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/p11.imageset/p11.JPG b/shopAp/shopAp/Assets.xcassets/p11.imageset/p11.JPG new file mode 100644 index 0000000..6224667 Binary files /dev/null and b/shopAp/shopAp/Assets.xcassets/p11.imageset/p11.JPG differ diff --git a/shopAp/shopAp/Assets.xcassets/p12.imageset/Contents.json b/shopAp/shopAp/Assets.xcassets/p12.imageset/Contents.json new file mode 100644 index 0000000..ea949d6 --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/p12.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "p12.JPG", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/p12.imageset/p12.JPG b/shopAp/shopAp/Assets.xcassets/p12.imageset/p12.JPG new file mode 100644 index 0000000..8269dec Binary files /dev/null and b/shopAp/shopAp/Assets.xcassets/p12.imageset/p12.JPG differ diff --git a/shopAp/shopAp/Assets.xcassets/p13.imageset/Contents.json b/shopAp/shopAp/Assets.xcassets/p13.imageset/Contents.json new file mode 100644 index 0000000..f9b92f0 --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/p13.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "p13.JPG", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/p13.imageset/p13.JPG b/shopAp/shopAp/Assets.xcassets/p13.imageset/p13.JPG new file mode 100644 index 0000000..02010e0 Binary files /dev/null and b/shopAp/shopAp/Assets.xcassets/p13.imageset/p13.JPG differ diff --git a/shopAp/shopAp/Assets.xcassets/p2.imageset/Contents.json b/shopAp/shopAp/Assets.xcassets/p2.imageset/Contents.json new file mode 100644 index 0000000..cca9507 --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/p2.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "p2.JPG", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/p2.imageset/p2.JPG b/shopAp/shopAp/Assets.xcassets/p2.imageset/p2.JPG new file mode 100644 index 0000000..5c19e02 Binary files /dev/null and b/shopAp/shopAp/Assets.xcassets/p2.imageset/p2.JPG differ diff --git a/shopAp/shopAp/Assets.xcassets/p3.imageset/Contents.json b/shopAp/shopAp/Assets.xcassets/p3.imageset/Contents.json new file mode 100644 index 0000000..1dae6ef --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/p3.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "p3.JPG", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/p3.imageset/p3.JPG b/shopAp/shopAp/Assets.xcassets/p3.imageset/p3.JPG new file mode 100644 index 0000000..c47f55e Binary files /dev/null and b/shopAp/shopAp/Assets.xcassets/p3.imageset/p3.JPG differ diff --git a/shopAp/shopAp/Assets.xcassets/p4.imageset/Contents.json b/shopAp/shopAp/Assets.xcassets/p4.imageset/Contents.json new file mode 100644 index 0000000..b416f9b --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/p4.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "p4.JPG", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/p4.imageset/p4.JPG b/shopAp/shopAp/Assets.xcassets/p4.imageset/p4.JPG new file mode 100644 index 0000000..d21e7f3 Binary files /dev/null and b/shopAp/shopAp/Assets.xcassets/p4.imageset/p4.JPG differ diff --git a/shopAp/shopAp/Assets.xcassets/p5.imageset/Contents.json b/shopAp/shopAp/Assets.xcassets/p5.imageset/Contents.json new file mode 100644 index 0000000..2ef01c7 --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/p5.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "p5.JPG", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/p5.imageset/p5.JPG b/shopAp/shopAp/Assets.xcassets/p5.imageset/p5.JPG new file mode 100644 index 0000000..8f7d6f8 Binary files /dev/null and b/shopAp/shopAp/Assets.xcassets/p5.imageset/p5.JPG differ diff --git a/shopAp/shopAp/Assets.xcassets/p8.imageset/Contents.json b/shopAp/shopAp/Assets.xcassets/p8.imageset/Contents.json new file mode 100644 index 0000000..b7ba39b --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/p8.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "p8.JPG", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/p8.imageset/p8.JPG b/shopAp/shopAp/Assets.xcassets/p8.imageset/p8.JPG new file mode 100644 index 0000000..55bbb6e Binary files /dev/null and b/shopAp/shopAp/Assets.xcassets/p8.imageset/p8.JPG differ diff --git a/shopAp/shopAp/Assets.xcassets/p9.imageset/Contents.json b/shopAp/shopAp/Assets.xcassets/p9.imageset/Contents.json new file mode 100644 index 0000000..0018347 --- /dev/null +++ b/shopAp/shopAp/Assets.xcassets/p9.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "p9.JPG", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/shopAp/shopAp/Assets.xcassets/p9.imageset/p9.JPG b/shopAp/shopAp/Assets.xcassets/p9.imageset/p9.JPG new file mode 100644 index 0000000..bf51ad3 Binary files /dev/null and b/shopAp/shopAp/Assets.xcassets/p9.imageset/p9.JPG differ diff --git a/shopAp/shopAp/Base.lproj/LaunchScreen.storyboard b/shopAp/shopAp/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..ff94fce --- /dev/null +++ b/shopAp/shopAp/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shopAp/shopAp/Base.lproj/Main.storyboard b/shopAp/shopAp/Base.lproj/Main.storyboard new file mode 100644 index 0000000..aef7d58 --- /dev/null +++ b/shopAp/shopAp/Base.lproj/Main.storyboard @@ -0,0 +1,978 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shopAp/shopAp/EditProduct.swift b/shopAp/shopAp/EditProduct.swift new file mode 100644 index 0000000..3fb9500 --- /dev/null +++ b/shopAp/shopAp/EditProduct.swift @@ -0,0 +1,86 @@ +// +// EditProduct.swift +// shopAp +// +// Created by MacBook on 16/03/1443 AH. +// + +import UIKit + +class EditProduct: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, MyCustomCellDelegator { + func callSegueFromCell(prodIndex: IndexPath) { + performSegue(withIdentifier: "show_product", sender: prodIndex) + } + + + var updateProducts: Array = allProduct + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return updateProducts.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + + let productCell = collectionView.dequeueReusableCell(withReuseIdentifier: "productCell", for: indexPath) as! updateCell + let product = updateProducts[indexPath.item] + productCell.setup(product: product, indexPath: indexPath) + productCell.delegate = self + + + return productCell + } + + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + let product = updateProducts[indexPath.item] + performSegue(withIdentifier: "show_product", sender: product) + } + + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + super.prepare(for: segue, sender: sender) + + if segue.identifier == "show_product" { + + let updatePage = segue.destination as! updatePage + updatePage.indexPath = sender as? IndexPath + } else { + let productVC = segue.destination as! productVC + productVC.J = sender as? Product + } + + self.updateCV?.reloadData() + + + } + + + + @IBOutlet weak var updateCV: UICollectionView! + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + + let screenWidth = view.bounds.size.width + return CGSize(width: screenWidth/2, height: 321) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } + + override func viewDidLoad() { + super.viewDidLoad() + + updateCV.delegate = self + updateCV.dataSource = self + + +// updateCV.reloadData() + // Do any additional setup after loading the view. + } + + +} + diff --git a/shopAp/shopAp/Info.plist b/shopAp/shopAp/Info.plist new file mode 100644 index 0000000..dd3c9af --- /dev/null +++ b/shopAp/shopAp/Info.plist @@ -0,0 +1,25 @@ + + + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + + diff --git a/shopAp/shopAp/Model.swift b/shopAp/shopAp/Model.swift new file mode 100644 index 0000000..66bf0b0 --- /dev/null +++ b/shopAp/shopAp/Model.swift @@ -0,0 +1,38 @@ +// +// Model.swift +// shopAp +// +// Created by MacBook on 14/03/1443 AH. +// + +import UIKit + +struct Product { + + var name: String + var image: UIImage! + var summary: String + var price: Double +} + + +var dProducts: Array = allProduct +var cart: Array = [] + +var purchasedProduct: Array = [] + +var allProduct : [Product] = [ + + Product(name: "Brown jacket", image: UIImage(named: "p1") , summary: "Brown jacket", price: 290.5), + Product(name: "Black jacket", image: UIImage(named: "p2"), summary: "Black-white jacket for women", price: 300.5), + Product(name: "Gray jacket", image: UIImage(named: "p3"), summary: "Elegant gray jacket for men", price: 350.5), + + Product(name: "Ferre Milano Watch", image: UIImage(named: "p5"), summary: "Ferre Milano Watch,gray blue", price: 1200.5), + Product(name: "D Milano Watch", image: UIImage(named: "p4"), summary: "D Milano Watch polycarbon,black", price: 900.5), + Product(name: "Adidas sneakers", image: UIImage(named: "p8"), summary: "Adidas sneakers,white", price: 600.5), + Product(name: "Nike sneakers", image: UIImage(named: "p9"), summary: "Nike sneakers,pink", price: 500.5), + Product(name: "Apple AirPods ", image: UIImage(named: "p12"), summary: "Apple AirPods headphones", price: 970.7), + Product(name: "Apple watch ", image: UIImage(named: "p11"), summary: "Apple watch series 7 ,off-white", price: 2099.8), +Product(name: "Power bank Anker ", image: UIImage(named: "p13"), summary: "power bank Anker Portable charger 10000", price: 290) + +] diff --git a/shopAp/shopAp/Product Page/productVC.swift b/shopAp/shopAp/Product Page/productVC.swift new file mode 100644 index 0000000..5bfa580 --- /dev/null +++ b/shopAp/shopAp/Product Page/productVC.swift @@ -0,0 +1,37 @@ +// +// productVC.swift +// shopAp +// +// Created by MacBook on 14/03/1443 AH. +// + +import UIKit +class productVC: UIViewController { + var J: Product? + var selectedProduct: Product? + + @IBOutlet weak var productImage: UIImageView! + + @IBOutlet weak var productName: UILabel! + @IBOutlet weak var productSummary: UILabel! + @IBOutlet weak var productPrice: UILabel! + + override func viewDidLoad() { +// super.viewDidLoad() + productImage.image = selectedProduct!.image + productName.text = selectedProduct!.name + productSummary.text = selectedProduct!.summary + productPrice.text = " \(selectedProduct!.price) " + + + + + } + + @IBAction func addToCartPressed(_ sender: Any) { + cart.append(selectedProduct!) + } + + + +} diff --git a/shopAp/shopAp/SceneDelegate.swift b/shopAp/shopAp/SceneDelegate.swift new file mode 100644 index 0000000..e75ef7f --- /dev/null +++ b/shopAp/shopAp/SceneDelegate.swift @@ -0,0 +1,52 @@ +// +// SceneDelegate.swift +// shopAp +// +// Created by MacBook on 14/03/1443 AH. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + guard let _ = (scene as? UIWindowScene) else { return } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } + + +} + diff --git a/shopAp/shopAp/addNewProduct.swift b/shopAp/shopAp/addNewProduct.swift new file mode 100644 index 0000000..10b4797 --- /dev/null +++ b/shopAp/shopAp/addNewProduct.swift @@ -0,0 +1,73 @@ + +import UIKit +class addNewProduct: + + UIViewController ,UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate{ + + override func viewDidLoad() { + super.viewDidLoad() + + nameAdd.delegate = self + priceAdd.delegate = self + descriptionAdd.delegate = self + } + + @IBOutlet weak var imageAdd: UIImageView! + + @IBOutlet weak var nameAdd: UITextField! + + @IBOutlet weak var priceAdd: UITextField! + + @IBOutlet weak var descriptionAdd: UITextField! + + @IBAction func addProductPhoto(_ sender: Any) { + + let picker = UIImagePickerController() + picker.allowsEditing = true + picker.delegate = self + present(picker,animated: true) + } + + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { + + let image = (info[.editedImage] ?? info[.originalImage]) as? UIImage + + imageAdd.image = image +dismiss(animated: true) +} + + + + @IBAction func ButtonCart(_ sender: Any) { + + + let picker = UIImagePickerController() + picker.allowsEditing = true + picker.delegate = self + present(picker,animated: true) + + } + + @IBAction func addProductButton(_ sender: Any) { + + allProduct.append(Product( + name: nameAdd.text!, + image: imageAdd.image, + summary: descriptionAdd.text!, + price: Double( priceAdd.text ?? " " ) ?? 0 )) + + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + + super.prepare(for: segue, sender: sender) + + let name1 = segue.destination as! productVC + name1.J = sender as? Product + } + + + + + } + diff --git a/shopAp/shopAp/cart Page/cartCell.swift b/shopAp/shopAp/cart Page/cartCell.swift new file mode 100644 index 0000000..02956c9 --- /dev/null +++ b/shopAp/shopAp/cart Page/cartCell.swift @@ -0,0 +1,24 @@ +// +// cartCell.swift +// shopAp +// +// Created by MacBook on 14/03/1443 AH. +// + +import UIKit +class cartCell: UITableViewCell{ + + @IBOutlet weak var cartImage: UIImageView! + @IBOutlet weak var nameLabel: UILabel! + @IBOutlet weak var summaryLabel: UILabel! + @IBOutlet weak var priceLabel: UILabel! + + + func setup(product: Product){ + cartImage.image = product.image + nameLabel.text = product.name + priceLabel.text = "\(product.price)" + } + +} + diff --git a/shopAp/shopAp/cart Page/cartVC.swift b/shopAp/shopAp/cart Page/cartVC.swift new file mode 100644 index 0000000..7624768 --- /dev/null +++ b/shopAp/shopAp/cart Page/cartVC.swift @@ -0,0 +1,52 @@ +// +// cartVC.swift +// shopAp +// +// Created by MacBook on 14/03/1443 AH. +// + +import UIKit + +class cartVC: UIViewController, UITableViewDelegate, UITableViewDataSource{ + + @IBOutlet weak var cartTV: UITableView! + + override func viewDidLoad() { + super.viewDidLoad() + cartTV.delegate = self + cartTV.dataSource = self + + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + cartTV.reloadData() + } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return cart.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cartCell = tableView.dequeueReusableCell(withIdentifier: "cartCell") as! cartCell + let product = cart[indexPath.row] + cartCell.setup(product: product) + + + return cartCell + } + + func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { + + + let deleteAction = UIContextualAction(style: .destructive, + title: "Delete") { _, _, _ in + cart.remove(at: indexPath.row) + tableView.deleteRows(at: [indexPath], with: .automatic) + } + return UISwipeActionsConfiguration(actions: [deleteAction]) + + } + + +} diff --git a/shopAp/shopAp/deleteCell.swift b/shopAp/shopAp/deleteCell.swift new file mode 100644 index 0000000..d1e4ea2 --- /dev/null +++ b/shopAp/shopAp/deleteCell.swift @@ -0,0 +1,37 @@ +import UIKit +protocol DataCollictionProtocol{ + + func deleteData(indx: Int) +} + +class deleteCell: UICollectionViewCell{ + var indexPath: IndexPath? + + @IBOutlet weak var dname: UILabel! + + @IBOutlet weak var dPrice: UILabel! + @IBOutlet weak var dImage: UIImageView! + + var delegate: DataCollictionProtocol? + + @IBAction func deleteButton(_ sender: Any) { + + delegate?.deleteData(indx: (indexPath?.row)!) + } + + func setup(product: Product){ + dImage.image = product.image + dname.text = product.name + dPrice.text = "\(product.price)" + + } + + + + + + + + + +} diff --git a/shopAp/shopAp/deleteProduct.swift b/shopAp/shopAp/deleteProduct.swift new file mode 100644 index 0000000..b3fa04e --- /dev/null +++ b/shopAp/shopAp/deleteProduct.swift @@ -0,0 +1,53 @@ +import UIKit + +class deleteProduct: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, DataCollictionProtocol{ + + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return dProducts.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + + let productCell = collectionView.dequeueReusableCell(withReuseIdentifier: "deleteCell", for: indexPath) as! deleteCell + productCell.indexPath = indexPath + productCell.delegate = self + let product = dProducts[indexPath.item] + productCell.setup(product: product) + + return productCell + } + + @IBOutlet weak var deleteCV: UICollectionView! + + + override func viewDidLoad() { + super.viewDidLoad() + + deleteCV.delegate = self + deleteCV.dataSource = self + deleteCV.reloadData() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + deleteCV.reloadData() + } + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + + let screenWidth = view.bounds.size.width + return CGSize(width: screenWidth/2, height: 321) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } + + func deleteData(indx: Int){ + let deletProduct = dProducts.remove(at: indx) + deleteCV.reloadData() + } +} diff --git a/shopAp/shopAp/purchaseVC.swift b/shopAp/shopAp/purchaseVC.swift new file mode 100644 index 0000000..212ce14 --- /dev/null +++ b/shopAp/shopAp/purchaseVC.swift @@ -0,0 +1,44 @@ +// +// purchaseVC.swift +// shopAp +// +// Created by MacBook on 14/03/1443 AH. +// + +import UIKit +class purchaseVC: UIViewController { + + @IBAction func purchaseB(_ sender: Any) { + +// let e = models[indexPath.row] + // message + + let alertController = UIAlertController(title: " Congratulations", message: + " You have complated your purchase", preferredStyle: UIAlertController.Style.alert) + // ok , cancel + alertController.addAction(UIAlertAction( + title: "OK ", + style: UIAlertAction.Style.default, + handler: { Action in + print ("OK") + + } + + )) + + alertController.addAction(UIAlertAction( + title: "cancel ", + style: UIAlertAction.Style.cancel, + handler: { Action in + print ("cancel") + } + + )) + //present + + present( alertController, animated: true, completion: nil) + + } + + +} diff --git a/shopAp/shopAp/store Page/productCell.swift b/shopAp/shopAp/store Page/productCell.swift new file mode 100644 index 0000000..98085cc --- /dev/null +++ b/shopAp/shopAp/store Page/productCell.swift @@ -0,0 +1,29 @@ +// +// productCell.swift +// shopAp +// +// Created by MacBook on 14/03/1443 AH. +// + +import UIKit + +class productCell: UICollectionViewCell { + var cellProduct: Product! + + @IBOutlet weak var productImage: UIImageView! + @IBOutlet weak var productName: UILabel! + + @IBOutlet weak var productPrice: UILabel! + + func setup(product: Product){ + productImage.image = product.image + productName.text = product.name + productPrice.text = "\(product.price)" + cellProduct = product + + } + + @IBAction func addToCartPressed(_ sender: Any) { + cart.append(cellProduct!) + } +} diff --git a/shopAp/shopAp/store Page/storeVC.swift b/shopAp/shopAp/store Page/storeVC.swift new file mode 100644 index 0000000..660f185 --- /dev/null +++ b/shopAp/shopAp/store Page/storeVC.swift @@ -0,0 +1,96 @@ +// +// ViewController.swift +// shopAp +// +// Created by MacBook on 14/03/1443 AH. +// + +import UIKit + +class storeVC: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UISearchBarDelegate { + + @IBOutlet weak var searchBar: UISearchBar! + + @IBOutlet weak var productsCV: UICollectionView! + + var searchProducts: Array = allProduct + + + + func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { + + if searchText.isEmpty { + searchProducts = allProduct + + } else { + + searchProducts = allProduct.filter({ oneProduct in + return oneProduct.name.starts(with: searchText) + }) + } + productsCV.reloadData() + + } + func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { + searchBar.resignFirstResponder() + } + + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return searchProducts.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + + let productCell = collectionView.dequeueReusableCell(withReuseIdentifier: "productCell", for: indexPath) as! productCell + let product = searchProducts[indexPath.item] + productCell.setup(product: product) + + return productCell + } + + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + let product = searchProducts[indexPath.item] + performSegue(withIdentifier: "show_product", sender: product) + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + super.prepare(for: segue, sender: sender) + let productVC = segue.destination as! productVC + productVC.selectedProduct = sender as! Product + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + + let screenWidth = view.bounds.size.width + return CGSize(width: screenWidth/2, height: 321) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } + + override func viewDidLoad() { + super.viewDidLoad() + + productsCV.delegate = self + productsCV.dataSource = self + searchBar.delegate = self + + productsCV.reloadData() + // Do any additional setup after loading the view. + } + + + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + searchProducts = allProduct + productsCV.reloadData() + } + +} + diff --git a/shopAp/shopAp/updateCell.swift b/shopAp/shopAp/updateCell.swift new file mode 100644 index 0000000..bd4f425 --- /dev/null +++ b/shopAp/shopAp/updateCell.swift @@ -0,0 +1,45 @@ +// +// updateCell.swift +// shopAp +// +// Created by MacBook on 16/03/1443 AH. +// + +import UIKit + +protocol MyCustomCellDelegator { + func callSegueFromCell(prodIndex: IndexPath) +} + +class updateCell: UICollectionViewCell{ + + var cellProduct: Product! + + var delegate: MyCustomCellDelegator! + @IBOutlet weak var updateImage: UIImageView! + + @IBOutlet weak var upName: UILabel! + + @IBOutlet weak var upPrice: UILabel! + + + var indrxPath: IndexPath? + func setup(product: Product, indexPath: IndexPath){ + + + + updateImage.image = product.image + upName.text = product.name + upPrice.text = "\(product.price)" + indrxPath = indexPath + + } + + + + @IBAction func updateButton(_ sender: Any) { + delegate.callSegueFromCell(prodIndex: indrxPath!) + + } + +} diff --git a/shopAp/shopAp/updatePage.swift b/shopAp/shopAp/updatePage.swift new file mode 100644 index 0000000..6263472 --- /dev/null +++ b/shopAp/shopAp/updatePage.swift @@ -0,0 +1,82 @@ +// +// updatePage.swift +// shopAp +// +// Created by MacBook on 16/03/1443 AH. +// + +import UIKit + +class updatePage: UIViewController, UIImagePickerControllerDelegate , UINavigationControllerDelegate { + +// var J: Product? +// var selectedProduct: Product? + var indexPath: IndexPath! + + @IBOutlet weak var imageu: UIImageView! + @IBOutlet weak var nameu: UILabel! + @IBOutlet weak var priceu: UILabel! + @IBOutlet weak var summaryu: UILabel! + + @IBAction func Changeimage(_ sender: Any) { + + let picker = UIImagePickerController() + picker.allowsEditing = true + picker.delegate = self + present(picker,animated: true) + + } + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { + let image = (info[.editedImage] ?? info[.originalImage]) as? UIImage + + imageu.image = image +dismiss(animated: true) +} + + @IBAction func changeImage(_ sender: Any) { + let picker = UIImagePickerController() + picker.allowsEditing = true + picker.delegate = self + present(picker,animated: true) + } + + @IBOutlet weak var nameT: UITextField! + @IBOutlet weak var priceT: UITextField! + @IBOutlet weak var summaryT: UITextField! + +// + override func viewDidLoad() { + + super.viewDidLoad() + + let product = allProduct[indexPath.row] +// super.viewDidLoad() + imageu.image = product.image + nameu.text = product.name + priceu.text = " \(product.price) " + summaryu.text = product.summary + + } + + @IBAction func addToCartPressed(_ sender: Any) { + + + let updatedProduct = Product( + name: nameT.text ?? "", + image: imageu.image, + summary: summaryT.text ?? "", + price: Double (priceT.text ?? " " ) ?? 0 + + ) + + + allProduct[indexPath.row] = updatedProduct + + + } + + + + + +}