diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..f0bc9d4 Binary files /dev/null and b/.DS_Store differ diff --git a/Macstore/Macstore.xcodeproj/project.pbxproj b/Macstore/Macstore.xcodeproj/project.pbxproj new file mode 100644 index 0000000..f8ff4dc --- /dev/null +++ b/Macstore/Macstore.xcodeproj/project.pbxproj @@ -0,0 +1,409 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + 7F91C90E27241D1700F9010E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F91C90D27241D1700F9010E /* AppDelegate.swift */; }; + 7F91C91027241D1700F9010E /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F91C90F27241D1700F9010E /* SceneDelegate.swift */; }; + 7F91C91527241D1700F9010E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7F91C91327241D1700F9010E /* Main.storyboard */; }; + 7F91C91727241D1800F9010E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7F91C91627241D1800F9010E /* Assets.xcassets */; }; + 7F91C91A27241D1800F9010E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7F91C91827241D1800F9010E /* LaunchScreen.storyboard */; }; + 7F91C9222724215D00F9010E /* Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F91C9212724215D00F9010E /* Data.swift */; }; + 7F91C9252724228600F9010E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F91C9242724228600F9010E /* ViewController.swift */; }; + 7F91C9272724229C00F9010E /* CartVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F91C9262724229C00F9010E /* CartVC.swift */; }; + 7F91C929272422B300F9010E /* ProductVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F91C928272422B300F9010E /* ProductVC.swift */; }; + 7F91C92B272422CC00F9010E /* ManageProductVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F91C92A272422CC00F9010E /* ManageProductVC.swift */; }; + 7F91C92D272422E100F9010E /* AddEditProductVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F91C92C272422E100F9010E /* AddEditProductVC.swift */; }; + 7F91C9302724231100F9010E /* ProductsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F91C92F2724231100F9010E /* ProductsCell.swift */; }; + 7F91C9322724232700F9010E /* CartCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F91C9312724232700F9010E /* CartCell.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 7F91C90A27241D1700F9010E /* Macstore.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Macstore.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 7F91C90D27241D1700F9010E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7F91C90F27241D1700F9010E /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 7F91C91427241D1700F9010E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 7F91C91627241D1800F9010E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 7F91C91927241D1800F9010E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 7F91C91B27241D1800F9010E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 7F91C9212724215D00F9010E /* Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = ""; }; + 7F91C9242724228600F9010E /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 7F91C9262724229C00F9010E /* CartVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CartVC.swift; sourceTree = ""; }; + 7F91C928272422B300F9010E /* ProductVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductVC.swift; sourceTree = ""; }; + 7F91C92A272422CC00F9010E /* ManageProductVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManageProductVC.swift; sourceTree = ""; }; + 7F91C92C272422E100F9010E /* AddEditProductVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddEditProductVC.swift; sourceTree = ""; }; + 7F91C92F2724231100F9010E /* ProductsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductsCell.swift; sourceTree = ""; }; + 7F91C9312724232700F9010E /* CartCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CartCell.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 7F91C90727241D1700F9010E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 7F91C90127241D1700F9010E = { + isa = PBXGroup; + children = ( + 7F91C90C27241D1700F9010E /* Macstore */, + 7F91C90B27241D1700F9010E /* Products */, + ); + sourceTree = ""; + }; + 7F91C90B27241D1700F9010E /* Products */ = { + isa = PBXGroup; + children = ( + 7F91C90A27241D1700F9010E /* Macstore.app */, + ); + name = Products; + sourceTree = ""; + }; + 7F91C90C27241D1700F9010E /* Macstore */ = { + isa = PBXGroup; + children = ( + 7F91C92E272422ED00F9010E /* Cells */, + 7F91C9232724224400F9010E /* Controller */, + 7F91C90D27241D1700F9010E /* AppDelegate.swift */, + 7F91C90F27241D1700F9010E /* SceneDelegate.swift */, + 7F91C9212724215D00F9010E /* Data.swift */, + 7F91C91327241D1700F9010E /* Main.storyboard */, + 7F91C91627241D1800F9010E /* Assets.xcassets */, + 7F91C91827241D1800F9010E /* LaunchScreen.storyboard */, + 7F91C91B27241D1800F9010E /* Info.plist */, + ); + path = Macstore; + sourceTree = ""; + }; + 7F91C9232724224400F9010E /* Controller */ = { + isa = PBXGroup; + children = ( + 7F91C9242724228600F9010E /* ViewController.swift */, + 7F91C9262724229C00F9010E /* CartVC.swift */, + 7F91C928272422B300F9010E /* ProductVC.swift */, + 7F91C92A272422CC00F9010E /* ManageProductVC.swift */, + 7F91C92C272422E100F9010E /* AddEditProductVC.swift */, + ); + path = Controller; + sourceTree = ""; + }; + 7F91C92E272422ED00F9010E /* Cells */ = { + isa = PBXGroup; + children = ( + 7F91C92F2724231100F9010E /* ProductsCell.swift */, + 7F91C9312724232700F9010E /* CartCell.swift */, + ); + path = Cells; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7F91C90927241D1700F9010E /* Macstore */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7F91C91E27241D1800F9010E /* Build configuration list for PBXNativeTarget "Macstore" */; + buildPhases = ( + 7F91C90627241D1700F9010E /* Sources */, + 7F91C90727241D1700F9010E /* Frameworks */, + 7F91C90827241D1700F9010E /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Macstore; + productName = Macstore; + productReference = 7F91C90A27241D1700F9010E /* Macstore.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7F91C90227241D1700F9010E /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1300; + LastUpgradeCheck = 1300; + TargetAttributes = { + 7F91C90927241D1700F9010E = { + CreatedOnToolsVersion = 13.0; + }; + }; + }; + buildConfigurationList = 7F91C90527241D1700F9010E /* Build configuration list for PBXProject "Macstore" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7F91C90127241D1700F9010E; + productRefGroup = 7F91C90B27241D1700F9010E /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7F91C90927241D1700F9010E /* Macstore */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7F91C90827241D1700F9010E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7F91C91A27241D1800F9010E /* LaunchScreen.storyboard in Resources */, + 7F91C91727241D1800F9010E /* Assets.xcassets in Resources */, + 7F91C91527241D1700F9010E /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7F91C90627241D1700F9010E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7F91C92B272422CC00F9010E /* ManageProductVC.swift in Sources */, + 7F91C9322724232700F9010E /* CartCell.swift in Sources */, + 7F91C929272422B300F9010E /* ProductVC.swift in Sources */, + 7F91C92D272422E100F9010E /* AddEditProductVC.swift in Sources */, + 7F91C90E27241D1700F9010E /* AppDelegate.swift in Sources */, + 7F91C9222724215D00F9010E /* Data.swift in Sources */, + 7F91C9302724231100F9010E /* ProductsCell.swift in Sources */, + 7F91C9252724228600F9010E /* ViewController.swift in Sources */, + 7F91C9272724229C00F9010E /* CartVC.swift in Sources */, + 7F91C91027241D1700F9010E /* SceneDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 7F91C91327241D1700F9010E /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 7F91C91427241D1700F9010E /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 7F91C91827241D1800F9010E /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 7F91C91927241D1800F9010E /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 7F91C91C27241D1800F9010E /* 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; + }; + 7F91C91D27241D1800F9010E /* 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; + }; + 7F91C91F27241D1800F9010E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 7KF66RXSZU; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = Macstore/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 = Sana.com.Macstore; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 7F91C92027241D1800F9010E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 7KF66RXSZU; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = Macstore/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 = Sana.com.Macstore; + 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 */ + 7F91C90527241D1700F9010E /* Build configuration list for PBXProject "Macstore" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7F91C91C27241D1800F9010E /* Debug */, + 7F91C91D27241D1800F9010E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7F91C91E27241D1800F9010E /* Build configuration list for PBXNativeTarget "Macstore" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7F91C91F27241D1800F9010E /* Debug */, + 7F91C92027241D1800F9010E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7F91C90227241D1700F9010E /* Project object */; +} diff --git a/Macstore/Macstore.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Macstore/Macstore.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Macstore/Macstore.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Macstore/Macstore.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Macstore/Macstore.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Macstore/Macstore.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Macstore/Macstore.xcodeproj/project.xcworkspace/xcuserdata/me...xcuserdatad/UserInterfaceState.xcuserstate b/Macstore/Macstore.xcodeproj/project.xcworkspace/xcuserdata/me...xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..311afb9 Binary files /dev/null and b/Macstore/Macstore.xcodeproj/project.xcworkspace/xcuserdata/me...xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Macstore/Macstore.xcodeproj/project.xcworkspace/xcuserdata/sanaalshahrani.xcuserdatad/UserInterfaceState.xcuserstate b/Macstore/Macstore.xcodeproj/project.xcworkspace/xcuserdata/sanaalshahrani.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..1c0c43d Binary files /dev/null and b/Macstore/Macstore.xcodeproj/project.xcworkspace/xcuserdata/sanaalshahrani.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Macstore/Macstore.xcodeproj/xcuserdata/me...xcuserdatad/xcschemes/xcschememanagement.plist b/Macstore/Macstore.xcodeproj/xcuserdata/me...xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..4b2c4a6 --- /dev/null +++ b/Macstore/Macstore.xcodeproj/xcuserdata/me...xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Macstore.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Macstore/Macstore.xcodeproj/xcuserdata/sanaalshahrani.xcuserdatad/xcschemes/xcschememanagement.plist b/Macstore/Macstore.xcodeproj/xcuserdata/sanaalshahrani.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..4b2c4a6 --- /dev/null +++ b/Macstore/Macstore.xcodeproj/xcuserdata/sanaalshahrani.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Macstore.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Macstore/Macstore/AppDelegate.swift b/Macstore/Macstore/AppDelegate.swift new file mode 100644 index 0000000..af7a965 --- /dev/null +++ b/Macstore/Macstore/AppDelegate.swift @@ -0,0 +1,36 @@ +// +// AppDelegate.swift +// Macstore +// +// Created by Me .. on 17/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/Macstore/Macstore/Assets.xcassets/AccentColor.colorset/Contents.json b/Macstore/Macstore/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/AppIcon.appiconset/Contents.json b/Macstore/Macstore/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/Macstore/Macstore/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/Macstore/Macstore/Assets.xcassets/Contents.json b/Macstore/Macstore/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/IMG_8603-1.imageset/Contents.json b/Macstore/Macstore/Assets.xcassets/IMG_8603-1.imageset/Contents.json new file mode 100644 index 0000000..8f1dd57 --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/IMG_8603-1.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "IMG_8603.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/IMG_8603-1.imageset/IMG_8603.jpg b/Macstore/Macstore/Assets.xcassets/IMG_8603-1.imageset/IMG_8603.jpg new file mode 100644 index 0000000..d0f0f12 Binary files /dev/null and b/Macstore/Macstore/Assets.xcassets/IMG_8603-1.imageset/IMG_8603.jpg differ diff --git a/Macstore/Macstore/Assets.xcassets/IMG_8603.imageset/Contents.json b/Macstore/Macstore/Assets.xcassets/IMG_8603.imageset/Contents.json new file mode 100644 index 0000000..8f1dd57 --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/IMG_8603.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "IMG_8603.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/IMG_8603.imageset/IMG_8603.jpg b/Macstore/Macstore/Assets.xcassets/IMG_8603.imageset/IMG_8603.jpg new file mode 100644 index 0000000..d0f0f12 Binary files /dev/null and b/Macstore/Macstore/Assets.xcassets/IMG_8603.imageset/IMG_8603.jpg differ diff --git a/Macstore/Macstore/Assets.xcassets/Lip.imageset/Contents.json b/Macstore/Macstore/Assets.xcassets/Lip.imageset/Contents.json new file mode 100644 index 0000000..e6aac26 --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/Lip.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Lip.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/Lip.imageset/Lip.jpg b/Macstore/Macstore/Assets.xcassets/Lip.imageset/Lip.jpg new file mode 100644 index 0000000..ca0d4e4 Binary files /dev/null and b/Macstore/Macstore/Assets.xcassets/Lip.imageset/Lip.jpg differ diff --git a/Macstore/Macstore/Assets.xcassets/con.imageset/Contents.json b/Macstore/Macstore/Assets.xcassets/con.imageset/Contents.json new file mode 100644 index 0000000..edb4f02 --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/con.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "con.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/con.imageset/con.jpg b/Macstore/Macstore/Assets.xcassets/con.imageset/con.jpg new file mode 100644 index 0000000..db06ea6 Binary files /dev/null and b/Macstore/Macstore/Assets.xcassets/con.imageset/con.jpg differ diff --git a/Macstore/Macstore/Assets.xcassets/fix.imageset/Contents.json b/Macstore/Macstore/Assets.xcassets/fix.imageset/Contents.json new file mode 100644 index 0000000..964845e --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/fix.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "fix.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/fix.imageset/fix.jpg b/Macstore/Macstore/Assets.xcassets/fix.imageset/fix.jpg new file mode 100644 index 0000000..58a5974 Binary files /dev/null and b/Macstore/Macstore/Assets.xcassets/fix.imageset/fix.jpg differ diff --git a/Macstore/Macstore/Assets.xcassets/found.imageset/Contents.json b/Macstore/Macstore/Assets.xcassets/found.imageset/Contents.json new file mode 100644 index 0000000..9d6f80e --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/found.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "found.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/found.imageset/found.jpg b/Macstore/Macstore/Assets.xcassets/found.imageset/found.jpg new file mode 100644 index 0000000..d1124a9 Binary files /dev/null and b/Macstore/Macstore/Assets.xcassets/found.imageset/found.jpg differ diff --git a/Macstore/Macstore/Assets.xcassets/lous.imageset/Contents.json b/Macstore/Macstore/Assets.xcassets/lous.imageset/Contents.json new file mode 100644 index 0000000..4396610 --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/lous.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "lous.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/lous.imageset/lous.jpg b/Macstore/Macstore/Assets.xcassets/lous.imageset/lous.jpg new file mode 100644 index 0000000..c04b660 Binary files /dev/null and b/Macstore/Macstore/Assets.xcassets/lous.imageset/lous.jpg differ diff --git a/Macstore/Macstore/Assets.xcassets/lp.imageset/Contents.json b/Macstore/Macstore/Assets.xcassets/lp.imageset/Contents.json new file mode 100644 index 0000000..9fa2a21 --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/lp.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "lp.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/lp.imageset/lp.jpg b/Macstore/Macstore/Assets.xcassets/lp.imageset/lp.jpg new file mode 100644 index 0000000..7d88682 Binary files /dev/null and b/Macstore/Macstore/Assets.xcassets/lp.imageset/lp.jpg differ diff --git a/Macstore/Macstore/Assets.xcassets/mas.imageset/Contents.json b/Macstore/Macstore/Assets.xcassets/mas.imageset/Contents.json new file mode 100644 index 0000000..8ded238 --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/mas.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "mas.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/mas.imageset/mas.jpg b/Macstore/Macstore/Assets.xcassets/mas.imageset/mas.jpg new file mode 100644 index 0000000..d83c179 Binary files /dev/null and b/Macstore/Macstore/Assets.xcassets/mas.imageset/mas.jpg differ diff --git a/Macstore/Macstore/Assets.xcassets/plush.imageset/Contents.json b/Macstore/Macstore/Assets.xcassets/plush.imageset/Contents.json new file mode 100644 index 0000000..0507d8f --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/plush.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "plush.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/plush.imageset/plush.jpg b/Macstore/Macstore/Assets.xcassets/plush.imageset/plush.jpg new file mode 100644 index 0000000..b122117 Binary files /dev/null and b/Macstore/Macstore/Assets.xcassets/plush.imageset/plush.jpg differ diff --git a/Macstore/Macstore/Assets.xcassets/powd.imageset/Contents.json b/Macstore/Macstore/Assets.xcassets/powd.imageset/Contents.json new file mode 100644 index 0000000..ce13f31 --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/powd.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "powd.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/powd.imageset/powd.jpg b/Macstore/Macstore/Assets.xcassets/powd.imageset/powd.jpg new file mode 100644 index 0000000..ce5d058 Binary files /dev/null and b/Macstore/Macstore/Assets.xcassets/powd.imageset/powd.jpg differ diff --git a/Macstore/Macstore/Assets.xcassets/shad.imageset/Contents.json b/Macstore/Macstore/Assets.xcassets/shad.imageset/Contents.json new file mode 100644 index 0000000..a2ba496 --- /dev/null +++ b/Macstore/Macstore/Assets.xcassets/shad.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "shad.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Macstore/Macstore/Assets.xcassets/shad.imageset/shad.jpg b/Macstore/Macstore/Assets.xcassets/shad.imageset/shad.jpg new file mode 100644 index 0000000..e295bd2 Binary files /dev/null and b/Macstore/Macstore/Assets.xcassets/shad.imageset/shad.jpg differ diff --git a/Macstore/Macstore/Base.lproj/LaunchScreen.storyboard b/Macstore/Macstore/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..d8015ef --- /dev/null +++ b/Macstore/Macstore/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Macstore/Macstore/Base.lproj/Main.storyboard b/Macstore/Macstore/Base.lproj/Main.storyboard new file mode 100644 index 0000000..2dbf708 --- /dev/null +++ b/Macstore/Macstore/Base.lproj/Main.storyboard @@ -0,0 +1,628 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Macstore/Macstore/Cells/CartCell.swift b/Macstore/Macstore/Cells/CartCell.swift new file mode 100644 index 0000000..5f27438 --- /dev/null +++ b/Macstore/Macstore/Cells/CartCell.swift @@ -0,0 +1,26 @@ +// +// CartCell.swift +// Macstore +// +// Created by Me .. on 17/03/1443 AH. +// + +import UIKit + +class CartCell: UITableViewCell{ + + @IBOutlet weak var ImageCart: UIImageView! + @IBOutlet weak var NameImageCart: UILabel! + @IBOutlet weak var SummaryCart: UILabel! + @IBOutlet weak var PriceCart: UILabel! + + func setup(prouduct: Product){ + + ImageCart.image = prouduct.image + NameImageCart.text = prouduct.name + SummaryCart.text = prouduct.description + PriceCart.text = prouduct.price + " SAR" + + } +} + diff --git a/Macstore/Macstore/Cells/ProductsCell.swift b/Macstore/Macstore/Cells/ProductsCell.swift new file mode 100644 index 0000000..a80b281 --- /dev/null +++ b/Macstore/Macstore/Cells/ProductsCell.swift @@ -0,0 +1,39 @@ +// +// ProductsCell.swift +// Macstore +// +// Created by Me .. on 17/03/1443 AH. +// + +import UIKit + +class ProductsCell: UICollectionViewCell{ + + var cellproduct: Product! + + @IBOutlet weak var prodcutStocks: UILabel! + @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) + print(cart.count) + + } + + +} + diff --git a/Macstore/Macstore/Controller/AddEditProductVC.swift b/Macstore/Macstore/Controller/AddEditProductVC.swift new file mode 100644 index 0000000..c9f418b --- /dev/null +++ b/Macstore/Macstore/Controller/AddEditProductVC.swift @@ -0,0 +1,94 @@ +// +// AddEditProductVC.swift +// Macstore +// +// Created by Me .. on 17/03/1443 AH. +// + +import UIKit + +class AddEditProductVC: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate { + + var selectedproduct: Product? + let pickerController = UIImagePickerController() + var index: Int = 0 + + @IBOutlet weak var productName: UITextField! + @IBOutlet weak var productSummary: UITextField! + @IBOutlet weak var productPrice: UITextField! + @IBOutlet weak var productQuantity: UITextField! + @IBOutlet weak var productImage: UIImageView! + + override func viewDidLoad() { + super.viewDidLoad() + + pickerController.delegate = self + pickerController.allowsEditing = true + + if let product = selectedproduct { + productName.text = product.name + productSummary.text = product.description + productPrice.text = product.price + productImage.image = product.image + productImage.isHidden = false + } + + } + + @IBAction func addProduct(_ sender: Any) { + + let name = productName.text + let summary = productSummary.text + let price = productPrice.text + let image = productImage.image + + if (name != nil) && (summary != nil) && (price != nil) && (image != nil) { + + let product = Product(price: price!, image: image!, description: description , name: name!) + + if selectedproduct != nil { + + macs[index] = product + + }else{ + + macs.insert(product, at: 0) + + } + + navigationController?.popViewController(animated: true) + + }else{ + + let alert = UIAlertController(title: "ERROR", message: "ALL FIELDS ARE REQUIRED", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "OK", style: .default)) + self.present(alert, animated: true) + + } + + } + + + @IBAction func selectImage(_ sender: Any) { + + self.pickerController.sourceType = .photoLibrary + self.present(self.pickerController, animated: true, completion: nil) + + } + + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) { + var image: UIImage = UIImage() + + if let img = info[UIImagePickerController.InfoKey.editedImage] as? UIImage { + image = img + } else if let img = info[UIImagePickerController.InfoKey.originalImage] as? UIImage { + image = img + } + + productImage.isHidden = false + productImage.image = image + + picker.dismiss(animated: true, completion: nil) + } +} + diff --git a/Macstore/Macstore/Controller/CartVC.swift b/Macstore/Macstore/Controller/CartVC.swift new file mode 100644 index 0000000..08127dd --- /dev/null +++ b/Macstore/Macstore/Controller/CartVC.swift @@ -0,0 +1,60 @@ +// +// CartVC.swift +// Macstore +// +// Created by Me .. on 17/03/1443 AH. +// + +import UIKit +class CartVC: UIViewController, UITableViewDelegate, UITableViewDataSource{ + + @IBOutlet weak var CartTBV: UITableView! + + override func viewDidLoad() { + super.viewDidLoad() + + CartTBV.dataSource=self + CartTBV.delegate=self + + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + CartTBV.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", for: indexPath) as! CartCell + + let product = cart[indexPath.row] + cartCell.setup(prouduct: product) + + return cartCell + + } + + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 150 + + } + + 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/Macstore/Macstore/Controller/ManageProductVC.swift b/Macstore/Macstore/Controller/ManageProductVC.swift new file mode 100644 index 0000000..c9a33b9 --- /dev/null +++ b/Macstore/Macstore/Controller/ManageProductVC.swift @@ -0,0 +1,88 @@ +// +// ManageProductVC.swift +// Macstore +// +// Created by Me .. on 17/03/1443 AH. +// + +import UIKit + +class ManageProductVC: UIViewController, UITableViewDelegate, UITableViewDataSource { + + @IBOutlet weak var tableView: UITableView! + + override func viewDidLoad() { + super.viewDidLoad() + + tableView.dataSource = self + tableView.delegate = self + + + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + tableView.reloadData() + } + + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return macs.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + + let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! CartCell + + let product = macs[indexPath.row] + cell.setup(prouduct: product) + + return cell + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let proudct = macs[indexPath.row] + let storyboard = UIStoryboard(name: "Main", bundle: nil) + let vc: ProductVC = storyboard.instantiateViewController(withIdentifier: "productDetails") as! ProductVC + vc.selectedproduct = proudct + vc.isManager = true + navigationController?.pushViewController(vc, animated: true) + } + + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 150 + } + + func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { + let deleteAction = UIContextualAction(style: .destructive, title: "Delete") {_,_,_ in + macs.remove(at: indexPath.row) + tableView.deleteRows(at: [indexPath], with: .automatic) + } + let editAction = UIContextualAction(style: .normal, title: "Edit") {_,_,_ in + // go to details + let proudct = macs[indexPath.row] + let storyboard = UIStoryboard(name: "Main", bundle: nil) + let vc = storyboard.instantiateViewController(withIdentifier: "addEditProduct") as! AddEditProductVC + vc.selectedproduct = proudct + vc.index = indexPath.row + self.navigationController?.pushViewController(vc, animated: true) + + } + + return UISwipeActionsConfiguration(actions: [deleteAction, editAction]) + } + + @IBAction func addProduct(_ sender: Any) { + let storyboard = UIStoryboard(name: "Main", bundle: nil) + let vc = storyboard.instantiateViewController(withIdentifier: "addEditProduct") as! AddEditProductVC + self.navigationController?.pushViewController(vc, animated: true) + } + + + + + + +} + diff --git a/Macstore/Macstore/Controller/ProductVC.swift b/Macstore/Macstore/Controller/ProductVC.swift new file mode 100644 index 0000000..9a2edd3 --- /dev/null +++ b/Macstore/Macstore/Controller/ProductVC.swift @@ -0,0 +1,41 @@ +// +// ProductVC.swift +// Macstore +// +// Created by Me .. on 17/03/1443 AH. +// + +import UIKit + + +class ProductVC: UIViewController{ + + var selectedproduct: Product? + var isManager: Bool = false + + @IBOutlet weak var addProductButton: UIButton! + @IBOutlet weak var ImageShowProudct: UIImageView! + @IBOutlet weak var ProudctNamePage: UILabel! + @IBOutlet weak var PriceProductPage: UILabel! + @IBOutlet weak var SummartProduct: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + + addProductButton.isHidden = isManager + + if let product = selectedproduct { + ProudctNamePage.text = product.name + PriceProductPage.text = product.price + " SAR" + SummartProduct.text = product.description + ImageShowProudct.image = product.image + } + + } + + @IBAction func AddToCartPressedPage(_ sender: Any) { + cart.append(selectedproduct!) + } + +} + diff --git a/Macstore/Macstore/Controller/ViewController.swift b/Macstore/Macstore/Controller/ViewController.swift new file mode 100644 index 0000000..32e0d28 --- /dev/null +++ b/Macstore/Macstore/Controller/ViewController.swift @@ -0,0 +1,81 @@ +// +// ViewController.swift +// Macstore +// +// Created by Me .. on 17/03/1443 AH. +// + +import UIKit + +class ViewController: UIViewController ,UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UISearchBarDelegate { + + + @IBOutlet weak var collectionView: UICollectionView! + lazy var searchBar = UISearchBar(frame: CGRect.zero) + var searchProduct: Array = macs + + override func viewDidLoad() { + super.viewDidLoad() + + collectionView.delegate = self + collectionView.dataSource = self + + searchBar.delegate = self + searchBar.placeholder = "Search" + navigationItem.titleView = searchBar + + } + + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return searchProduct.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let productcell = collectionView.dequeueReusableCell(withReuseIdentifier: "123", for: indexPath) as! ProductsCell + + let proudct = searchProduct[indexPath.row] + productcell.setup(product: proudct) + + return productcell + } + + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + let proudct = searchProduct[indexPath.row] + let storyboard = UIStoryboard(name: "Main", bundle: nil) + let vc: ProductVC = storyboard.instantiateViewController(withIdentifier: "productDetails") as! ProductVC + vc.selectedproduct = proudct + vc.isManager = false + navigationController?.pushViewController(vc, animated: true) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + let screenWidth = view.bounds.size.width + return CGSize(width: screenWidth/2, height: 335) + } + + 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 searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { + if searchText.isEmpty { + searchProduct = macs + }else{ + searchProduct = macs.filter({ oneproduct in + return oneproduct.name.starts(with: searchText) + }) + } + collectionView.reloadData() + } + + +} + + + diff --git a/Macstore/Macstore/Data.swift b/Macstore/Macstore/Data.swift new file mode 100644 index 0000000..a76437e --- /dev/null +++ b/Macstore/Macstore/Data.swift @@ -0,0 +1,33 @@ +// +// Data.swift +// Macstore +// +// Created by Me .. on 17/03/1443 AH. +// +import UIKit + +struct Product { + + let price: String + let image: UIImage! + let description: String + let name: String +} +var cart: Array = [] +var purchasedProducts: Array = [] +var dproducts:Array = macs +var macs: [Product] = [ + + Product(price: "90", image: UIImage(named:"lp"), description: "water proof", name: "Lipstick"), + Product(price: "120", image: UIImage(named:"mas"), description: "volume mascara", name: "Mascara"), + Product(price: "200", image: UIImage(named:"lous"), description: "highliting powder", name: "Loosepowder"), + Product(price: "130", image: UIImage(named: "fix"), description: "makeup Fixing", name: "Fixplus"), + Product(price: "80", image: UIImage(named:"con"), description: "correction cream", name: "Concealer"), + Product(price: "150", image: UIImage(named:"powd"), description: "compact powder", name: "Powder"), + Product(price: "50", image: UIImage(named:"plush"), description: "plush powder", name: "Blush"), + Product(price: "90", image: UIImage(named:"Lip"), description: "water proof", name: "Lipstick"), + Product(price: "200", image: UIImage(named: "found"), description: "full-cover foundation", name: "Foundation"), + Product(price: "200", image: UIImage(named:"shad"), description: "Eye shadow", name: "Shadow") +] + +var searchMac = [String]() diff --git a/Macstore/Macstore/Info.plist b/Macstore/Macstore/Info.plist new file mode 100644 index 0000000..dd3c9af --- /dev/null +++ b/Macstore/Macstore/Info.plist @@ -0,0 +1,25 @@ + + + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + + diff --git a/Macstore/Macstore/SceneDelegate.swift b/Macstore/Macstore/SceneDelegate.swift new file mode 100644 index 0000000..f27da8e --- /dev/null +++ b/Macstore/Macstore/SceneDelegate.swift @@ -0,0 +1,52 @@ +// +// SceneDelegate.swift +// Macstore +// +// Created by Me .. on 17/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. + } + + +} +