diff --git a/iHerb/iHerb.xcodeproj/project.pbxproj b/iHerb/iHerb.xcodeproj/project.pbxproj new file mode 100644 index 0000000..2ca5602 --- /dev/null +++ b/iHerb/iHerb.xcodeproj/project.pbxproj @@ -0,0 +1,389 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + 96AABDDB271D328200EA8ACD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96AABDDA271D328200EA8ACD /* AppDelegate.swift */; }; + 96AABDDD271D328200EA8ACD /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96AABDDC271D328200EA8ACD /* SceneDelegate.swift */; }; + 96AABDDF271D328200EA8ACD /* StoreVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96AABDDE271D328200EA8ACD /* StoreVC.swift */; }; + 96AABDE2271D328200EA8ACD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96AABDE0271D328200EA8ACD /* Main.storyboard */; }; + 96AABDE4271D328300EA8ACD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96AABDE3271D328300EA8ACD /* Assets.xcassets */; }; + 96AABDE7271D328300EA8ACD /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96AABDE5271D328300EA8ACD /* LaunchScreen.storyboard */; }; + 96AABDEF271D342500EA8ACD /* StoreCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96AABDEE271D342500EA8ACD /* StoreCell.swift */; }; + 96AABDF1271D37A600EA8ACD /* Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96AABDF0271D37A600EA8ACD /* Data.swift */; }; + 96AABDF3271DD2E000EA8ACD /* ProductVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96AABDF2271DD2E000EA8ACD /* ProductVC.swift */; }; + 96F3F0102723209E006EE74F /* ManegerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96F3F00F2723209E006EE74F /* ManegerVC.swift */; }; + 96F3F01227233894006EE74F /* EditeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96F3F01127233894006EE74F /* EditeVC.swift */; }; + 96FABB12271FFB87002A9DB3 /* CartVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96FABB11271FFB87002A9DB3 /* CartVC.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 96AABDD7271D328200EA8ACD /* iHerb.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iHerb.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 96AABDDA271D328200EA8ACD /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 96AABDDC271D328200EA8ACD /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 96AABDDE271D328200EA8ACD /* StoreVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreVC.swift; sourceTree = ""; }; + 96AABDE1271D328200EA8ACD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 96AABDE3271D328300EA8ACD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 96AABDE6271D328300EA8ACD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 96AABDE8271D328300EA8ACD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 96AABDEE271D342500EA8ACD /* StoreCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreCell.swift; sourceTree = ""; }; + 96AABDF0271D37A600EA8ACD /* Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = ""; }; + 96AABDF2271DD2E000EA8ACD /* ProductVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductVC.swift; sourceTree = ""; }; + 96F3F00F2723209E006EE74F /* ManegerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManegerVC.swift; sourceTree = ""; }; + 96F3F01127233894006EE74F /* EditeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditeVC.swift; sourceTree = ""; }; + 96FABB11271FFB87002A9DB3 /* CartVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CartVC.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 96AABDD4271D328200EA8ACD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 96AABDCE271D328200EA8ACD = { + isa = PBXGroup; + children = ( + 96AABDD9271D328200EA8ACD /* iHerb */, + 96AABDD8271D328200EA8ACD /* Products */, + ); + sourceTree = ""; + }; + 96AABDD8271D328200EA8ACD /* Products */ = { + isa = PBXGroup; + children = ( + 96AABDD7271D328200EA8ACD /* iHerb.app */, + ); + name = Products; + sourceTree = ""; + }; + 96AABDD9271D328200EA8ACD /* iHerb */ = { + isa = PBXGroup; + children = ( + 96AABDDA271D328200EA8ACD /* AppDelegate.swift */, + 96AABDDC271D328200EA8ACD /* SceneDelegate.swift */, + 96AABDDE271D328200EA8ACD /* StoreVC.swift */, + 96AABDEE271D342500EA8ACD /* StoreCell.swift */, + 96AABDF2271DD2E000EA8ACD /* ProductVC.swift */, + 96FABB11271FFB87002A9DB3 /* CartVC.swift */, + 96AABDE0271D328200EA8ACD /* Main.storyboard */, + 96AABDE3271D328300EA8ACD /* Assets.xcassets */, + 96AABDE5271D328300EA8ACD /* LaunchScreen.storyboard */, + 96AABDE8271D328300EA8ACD /* Info.plist */, + 96AABDF0271D37A600EA8ACD /* Data.swift */, + 96F3F00F2723209E006EE74F /* ManegerVC.swift */, + 96F3F01127233894006EE74F /* EditeVC.swift */, + ); + path = iHerb; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 96AABDD6271D328200EA8ACD /* iHerb */ = { + isa = PBXNativeTarget; + buildConfigurationList = 96AABDEB271D328300EA8ACD /* Build configuration list for PBXNativeTarget "iHerb" */; + buildPhases = ( + 96AABDD3271D328200EA8ACD /* Sources */, + 96AABDD4271D328200EA8ACD /* Frameworks */, + 96AABDD5271D328200EA8ACD /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = iHerb; + productName = iHerb; + productReference = 96AABDD7271D328200EA8ACD /* iHerb.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 96AABDCF271D328200EA8ACD /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1300; + LastUpgradeCheck = 1300; + TargetAttributes = { + 96AABDD6271D328200EA8ACD = { + CreatedOnToolsVersion = 13.0; + }; + }; + }; + buildConfigurationList = 96AABDD2271D328200EA8ACD /* Build configuration list for PBXProject "iHerb" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 96AABDCE271D328200EA8ACD; + productRefGroup = 96AABDD8271D328200EA8ACD /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 96AABDD6271D328200EA8ACD /* iHerb */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 96AABDD5271D328200EA8ACD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 96AABDE7271D328300EA8ACD /* LaunchScreen.storyboard in Resources */, + 96AABDE4271D328300EA8ACD /* Assets.xcassets in Resources */, + 96AABDE2271D328200EA8ACD /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 96AABDD3271D328200EA8ACD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 96AABDEF271D342500EA8ACD /* StoreCell.swift in Sources */, + 96F3F01227233894006EE74F /* EditeVC.swift in Sources */, + 96AABDF1271D37A600EA8ACD /* Data.swift in Sources */, + 96F3F0102723209E006EE74F /* ManegerVC.swift in Sources */, + 96AABDDF271D328200EA8ACD /* StoreVC.swift in Sources */, + 96AABDDB271D328200EA8ACD /* AppDelegate.swift in Sources */, + 96AABDDD271D328200EA8ACD /* SceneDelegate.swift in Sources */, + 96FABB12271FFB87002A9DB3 /* CartVC.swift in Sources */, + 96AABDF3271DD2E000EA8ACD /* ProductVC.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 96AABDE0271D328200EA8ACD /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 96AABDE1271D328200EA8ACD /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 96AABDE5271D328300EA8ACD /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 96AABDE6271D328300EA8ACD /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 96AABDE9271D328300EA8ACD /* 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; + }; + 96AABDEA271D328300EA8ACD /* 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; + }; + 96AABDEC271D328300EA8ACD /* 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 = UHBQU77Z37; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = iHerb/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 = com.saraM.iHerb; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 96AABDED271D328300EA8ACD /* 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 = UHBQU77Z37; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = iHerb/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 = com.saraM.iHerb; + 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 */ + 96AABDD2271D328200EA8ACD /* Build configuration list for PBXProject "iHerb" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 96AABDE9271D328300EA8ACD /* Debug */, + 96AABDEA271D328300EA8ACD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 96AABDEB271D328300EA8ACD /* Build configuration list for PBXNativeTarget "iHerb" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 96AABDEC271D328300EA8ACD /* Debug */, + 96AABDED271D328300EA8ACD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 96AABDCF271D328200EA8ACD /* Project object */; +} diff --git a/iHerb/iHerb.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/iHerb/iHerb.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/iHerb/iHerb.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/iHerb/iHerb.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/iHerb/iHerb.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/iHerb/iHerb.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/iHerb/iHerb.xcodeproj/project.xcworkspace/xcuserdata/saram.xcuserdatad/UserInterfaceState.xcuserstate b/iHerb/iHerb.xcodeproj/project.xcworkspace/xcuserdata/saram.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..63415e7 Binary files /dev/null and b/iHerb/iHerb.xcodeproj/project.xcworkspace/xcuserdata/saram.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/iHerb/iHerb.xcodeproj/xcuserdata/saram.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/iHerb/iHerb.xcodeproj/xcuserdata/saram.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..049287b --- /dev/null +++ b/iHerb/iHerb.xcodeproj/xcuserdata/saram.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,6 @@ + + + diff --git a/iHerb/iHerb.xcodeproj/xcuserdata/saram.xcuserdatad/xcschemes/xcschememanagement.plist b/iHerb/iHerb.xcodeproj/xcuserdata/saram.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..8d4614d --- /dev/null +++ b/iHerb/iHerb.xcodeproj/xcuserdata/saram.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + iHerb.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/iHerb/iHerb/AppDelegate.swift b/iHerb/iHerb/AppDelegate.swift new file mode 100644 index 0000000..030ae81 --- /dev/null +++ b/iHerb/iHerb/AppDelegate.swift @@ -0,0 +1,36 @@ +// +// AppDelegate.swift +// iHerb +// +// Created by Sara M on 12/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/iHerb/iHerb/Assets.xcassets/1.imageset/Contents.json b/iHerb/iHerb/Assets.xcassets/1.imageset/Contents.json new file mode 100644 index 0000000..0d3a33d --- /dev/null +++ b/iHerb/iHerb/Assets.xcassets/1.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "IMG_2800.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iHerb/iHerb/Assets.xcassets/1.imageset/IMG_2800.jpg b/iHerb/iHerb/Assets.xcassets/1.imageset/IMG_2800.jpg new file mode 100644 index 0000000..5430643 Binary files /dev/null and b/iHerb/iHerb/Assets.xcassets/1.imageset/IMG_2800.jpg differ diff --git a/iHerb/iHerb/Assets.xcassets/2.imageset/Contents.json b/iHerb/iHerb/Assets.xcassets/2.imageset/Contents.json new file mode 100644 index 0000000..3757681 --- /dev/null +++ b/iHerb/iHerb/Assets.xcassets/2.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "IMG_2798.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iHerb/iHerb/Assets.xcassets/2.imageset/IMG_2798.jpg b/iHerb/iHerb/Assets.xcassets/2.imageset/IMG_2798.jpg new file mode 100644 index 0000000..0290711 Binary files /dev/null and b/iHerb/iHerb/Assets.xcassets/2.imageset/IMG_2798.jpg differ diff --git a/iHerb/iHerb/Assets.xcassets/3.imageset/Contents.json b/iHerb/iHerb/Assets.xcassets/3.imageset/Contents.json new file mode 100644 index 0000000..9240142 --- /dev/null +++ b/iHerb/iHerb/Assets.xcassets/3.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "IMG_2797.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iHerb/iHerb/Assets.xcassets/3.imageset/IMG_2797.jpg b/iHerb/iHerb/Assets.xcassets/3.imageset/IMG_2797.jpg new file mode 100644 index 0000000..021482f Binary files /dev/null and b/iHerb/iHerb/Assets.xcassets/3.imageset/IMG_2797.jpg differ diff --git a/iHerb/iHerb/Assets.xcassets/4.imageset/Contents.json b/iHerb/iHerb/Assets.xcassets/4.imageset/Contents.json new file mode 100644 index 0000000..ae1a089 --- /dev/null +++ b/iHerb/iHerb/Assets.xcassets/4.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "IMG_2795.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iHerb/iHerb/Assets.xcassets/4.imageset/IMG_2795.jpg b/iHerb/iHerb/Assets.xcassets/4.imageset/IMG_2795.jpg new file mode 100644 index 0000000..7b27be2 Binary files /dev/null and b/iHerb/iHerb/Assets.xcassets/4.imageset/IMG_2795.jpg differ diff --git a/iHerb/iHerb/Assets.xcassets/5.imageset/Contents.json b/iHerb/iHerb/Assets.xcassets/5.imageset/Contents.json new file mode 100644 index 0000000..b7ffe88 --- /dev/null +++ b/iHerb/iHerb/Assets.xcassets/5.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "IMG_2796.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iHerb/iHerb/Assets.xcassets/5.imageset/IMG_2796.jpg b/iHerb/iHerb/Assets.xcassets/5.imageset/IMG_2796.jpg new file mode 100644 index 0000000..99d8390 Binary files /dev/null and b/iHerb/iHerb/Assets.xcassets/5.imageset/IMG_2796.jpg differ diff --git a/iHerb/iHerb/Assets.xcassets/6.imageset/Contents.json b/iHerb/iHerb/Assets.xcassets/6.imageset/Contents.json new file mode 100644 index 0000000..dd5b227 --- /dev/null +++ b/iHerb/iHerb/Assets.xcassets/6.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "IMG_2794.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iHerb/iHerb/Assets.xcassets/6.imageset/IMG_2794.jpg b/iHerb/iHerb/Assets.xcassets/6.imageset/IMG_2794.jpg new file mode 100644 index 0000000..c734df7 Binary files /dev/null and b/iHerb/iHerb/Assets.xcassets/6.imageset/IMG_2794.jpg differ diff --git a/iHerb/iHerb/Assets.xcassets/AccentColor.colorset/Contents.json b/iHerb/iHerb/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/iHerb/iHerb/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iHerb/iHerb/Assets.xcassets/AppIcon.appiconset/Contents.json b/iHerb/iHerb/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/iHerb/iHerb/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/iHerb/iHerb/Assets.xcassets/Contents.json b/iHerb/iHerb/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/iHerb/iHerb/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iHerb/iHerb/Assets.xcassets/logo.imageset/Contents.json b/iHerb/iHerb/Assets.xcassets/logo.imageset/Contents.json new file mode 100644 index 0000000..b90e068 --- /dev/null +++ b/iHerb/iHerb/Assets.xcassets/logo.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "IMG_2805.JPG", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iHerb/iHerb/Assets.xcassets/logo.imageset/IMG_2805.JPG b/iHerb/iHerb/Assets.xcassets/logo.imageset/IMG_2805.JPG new file mode 100644 index 0000000..2ec42a0 Binary files /dev/null and b/iHerb/iHerb/Assets.xcassets/logo.imageset/IMG_2805.JPG differ diff --git a/iHerb/iHerb/Base.lproj/LaunchScreen.storyboard b/iHerb/iHerb/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..23268ce --- /dev/null +++ b/iHerb/iHerb/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iHerb/iHerb/Base.lproj/Main.storyboard b/iHerb/iHerb/Base.lproj/Main.storyboard new file mode 100644 index 0000000..233b98b --- /dev/null +++ b/iHerb/iHerb/Base.lproj/Main.storyboard @@ -0,0 +1,677 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iHerb/iHerb/CartVC.swift b/iHerb/iHerb/CartVC.swift new file mode 100644 index 0000000..1d9e3e3 --- /dev/null +++ b/iHerb/iHerb/CartVC.swift @@ -0,0 +1,73 @@ +// +// ViewController3.swift +// iHerb +// +// Created by Sara M on 14/03/1443 AH. +// + + +import UIKit + +class CartVC: UIViewController, UITableViewDelegate, UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return cart.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cartCell = tableView.dequeueReusableCell(withIdentifier: "showCell", for: indexPath) as! CartCell + + + let product = cart[indexPath.row] + cartCell.setup(product: product) + return cartCell + } + + func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { + + + let deleteAcion = UIContextualAction( + style: .destructive, + title: "Delete") { _, _, _ in + + cart.remove(at: indexPath.row) + + tableView.deleteRows(at: [indexPath], + with: .automatic) + } + return UISwipeActionsConfiguration(actions: + [deleteAcion] + ) } + + + + @IBOutlet weak var TableVC: UITableView! + + @IBAction func Checkout(_ sender: Any) { + } + override func viewDidLoad() { + super.viewDidLoad() + TableVC.delegate = self + TableVC.dataSource = self + + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + TableVC.reloadData() + } +} + +class CartCell: UITableViewCell{ + + @IBOutlet weak var imageCell: UIImageView! + @IBOutlet weak var nameCell: UILabel! + @IBOutlet weak var priceCell: UILabel! + + func setup(product: Product) { + + imageCell.image = product.logo + nameCell.text = product.name + priceCell.text = "\(product.price)" + + } +} diff --git a/iHerb/iHerb/Data.swift b/iHerb/iHerb/Data.swift new file mode 100644 index 0000000..8d7c88e --- /dev/null +++ b/iHerb/iHerb/Data.swift @@ -0,0 +1,78 @@ +// +// Data.swift +// iHerb +// +// Created by Sara M on 12/03/1443 AH. +// + + +import UIKit + + + +struct Product { + + let name: String + let rating: String + let logo: UIImage? + let price: Int + let state: String + +} + + + +var cart: Array = [] +var purchasedProduct: Array = [] + + +var productList: Array = [ + Product ( + name: "Moisturizing Cream,Very Dry, Sensitive Skin,(85g)", + rating: "⭐️⭐️⭐️⭐️" , + logo: UIImage (named: "6"), + price: 30, + state: "InStock"), + + + Product( + name: "Fresh Breath Oral Rinse,Invigorating Icy Mint,(473ml)", + rating: "⭐️⭐️⭐️", + logo: UIImage(named: "4"), + price: 50, + state: "InStock"), + + + Product( + name: "Arabic Coffee Scrub,(567g)", + rating: "⭐️⭐️⭐️⭐️⭐️", + logo: UIImage(named: "5"), + price: 56, + state: "InStock"), + + + Product( + name: "Daily Facial Cleanser, (237ml)", + rating: "⭐️⭐️⭐️⭐️", + logo: UIImage(named: "2"), + price: 52, + state: "InStock"), + + + Product( + name: "Thickening shampoo,Therapy,(414ml)", + rating: "⭐️⭐️⭐️", + logo: UIImage(named: "3"), + price: 51, + state: "InStock"), + + + Product( + name: "Solution,Sweet Almond Oil,(473ml)", + rating: "⭐️⭐️⭐️⭐️", + logo: UIImage(named: "1"), + price: 42, + state: "InStock") +] + + diff --git a/iHerb/iHerb/EditeVC.swift b/iHerb/iHerb/EditeVC.swift new file mode 100644 index 0000000..af49fa9 --- /dev/null +++ b/iHerb/iHerb/EditeVC.swift @@ -0,0 +1,53 @@ +// +// EditeVC.swift +// iHerb +// +// Created by Sara M on 16/03/1443 AH. +// + +import UIKit + +class EditeVC : UIViewController{ + + var indexPath: IndexPath! + + + + @IBOutlet weak var imageUpdate: UIImageView! + @IBOutlet weak var NameUpdate: UITextField! + @IBOutlet weak var RatingUpdate: UITextField! + @IBOutlet weak var PraiceUpdate: UITextField! + @IBOutlet weak var Stateupdate: UITextField! + + + override func viewDidLoad() { + super.viewDidLoad() + + let pro = productList[indexPath.row] + NameUpdate.text = pro.name + imageUpdate.image = pro.logo + RatingUpdate.text = pro.rating + PraiceUpdate.text = "\(pro.price)" + Stateupdate.text = pro.state + } + + + @IBAction func updatebutton(_ sender: Any) { + + let updatedProduct = Product(name: NameUpdate.text ?? "", + rating: RatingUpdate.text ?? "", + logo: imageUpdate.image , + price:Int(PraiceUpdate.text ?? "")! , + state: Stateupdate.text ?? "") + + + productList[indexPath.row] = updatedProduct + + + } + + + + +} + diff --git a/iHerb/iHerb/Info.plist b/iHerb/iHerb/Info.plist new file mode 100644 index 0000000..dd3c9af --- /dev/null +++ b/iHerb/iHerb/Info.plist @@ -0,0 +1,25 @@ + + + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + + diff --git a/iHerb/iHerb/ManegerVC.swift b/iHerb/iHerb/ManegerVC.swift new file mode 100644 index 0000000..fd21cca --- /dev/null +++ b/iHerb/iHerb/ManegerVC.swift @@ -0,0 +1,66 @@ +// +// ManegerVC.swift +// iHerb +// +// Created by Sara M on 16/03/1443 AH. +// + + + +import UIKit + + +class ManegerVC:UIViewController,UINavigationControllerDelegate, UITextFieldDelegate,UIImagePickerControllerDelegate { + + + + + @IBOutlet weak var PriceTF: UITextField! + + @IBOutlet weak var ImageVC: UIImageView! + + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { + + let image = (info[.editedImage] ?? info[.originalImage]) as! UIImage + ImageVC.image = image + dismiss(animated: true) + } + + + @IBOutlet weak var RatingTF: UITextField! + @IBOutlet weak var StateTF: UITextField! + @IBOutlet weak var NameTF: UITextField! + @IBAction func uploadImage(_ sender: Any) { + let picker = UIImagePickerController() + picker.allowsEditing = true + picker.delegate = self + present(picker,animated: true) + + } + + @IBAction func manageAdd(_ sender: Any){ + productList.append(Product( + name: NameTF.text ?? "", + rating: RatingTF.text ?? "", + logo: ImageVC.image , + price:Int(PriceTF.text ?? "")! , + state: StateTF.text ?? "") + ) + + } + + + override func viewDidLoad() { + super .viewDidLoad() + + } + + +} + + + + + + + diff --git a/iHerb/iHerb/ProductVC.swift b/iHerb/iHerb/ProductVC.swift new file mode 100644 index 0000000..0559021 --- /dev/null +++ b/iHerb/iHerb/ProductVC.swift @@ -0,0 +1,48 @@ +// +// ViewController2.swift +// iHerb +// +// Created by Sara M on 12/03/1443 AH. +// + +import UIKit + +class ProductVC: UIViewController { + + + var productsFromViewController: Product? + + override func viewDidLoad() { + super.viewDidLoad() + + + if productsFromViewController != nil{ + nameVC.text = productsFromViewController?.name + ratingVC.text = productsFromViewController?.rating + priceVC.text = "\(productsFromViewController!.price)" + stateVC.text = productsFromViewController?.state + imageVC.image = productsFromViewController?.logo + + } + + } + + + + + + + + @IBOutlet weak var nameVC: UILabel! + @IBOutlet weak var ratingVC: UILabel! + @IBOutlet weak var stateVC: UILabel! + @IBOutlet weak var imageVC: UIImageView! + @IBOutlet weak var priceVC: UILabel! + + + @IBAction func ADDtoCart(_ sender: Any) { + + cart.append(productsFromViewController!) + } + +} diff --git a/iHerb/iHerb/SceneDelegate.swift b/iHerb/iHerb/SceneDelegate.swift new file mode 100644 index 0000000..b7b8b1e --- /dev/null +++ b/iHerb/iHerb/SceneDelegate.swift @@ -0,0 +1,52 @@ +// +// SceneDelegate.swift +// iHerb +// +// Created by Sara M on 12/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/iHerb/iHerb/StoreCell.swift b/iHerb/iHerb/StoreCell.swift new file mode 100644 index 0000000..8dac125 --- /dev/null +++ b/iHerb/iHerb/StoreCell.swift @@ -0,0 +1,44 @@ +// +// PicCell.swift +// iHerb +// +// Created by Sara M on 12/03/1443 AH. +// + +import UIKit +protocol MyCustomCellDelegator { + func callSegueFromCell(prodIndex: IndexPath) +} +class StoreCell : UICollectionViewCell { + + var delegate: MyCustomCellDelegator! + + + + @IBAction func Update(_ sender: Any) { + } + @IBOutlet weak var picview: UIImageView! + @IBOutlet weak var namelabel: UILabel! + @IBOutlet weak var ratinglabel: UILabel! + @IBOutlet weak var pricelabel: UILabel! + @IBOutlet weak var statelabel: UILabel! + + + var indrxPath: IndexPath? + + func setup(with productList: Product, indexPath: IndexPath){ + + + picview.image = productList.logo + pricelabel.text = "\(productList.price)" + namelabel.text = productList.name + statelabel.text = productList.state + ratinglabel.text = productList.rating + indrxPath = indexPath + } + + @IBAction func UpdateCell(_ sender: Any) { + + delegate.callSegueFromCell(prodIndex: indrxPath!) + } +} diff --git a/iHerb/iHerb/StoreVC.swift b/iHerb/iHerb/StoreVC.swift new file mode 100644 index 0000000..7df4b71 --- /dev/null +++ b/iHerb/iHerb/StoreVC.swift @@ -0,0 +1,104 @@ +// +// ViewController.swift +// iHerb +// +// Created by Sara M on 12/03/1443 AH. +// + +import UIKit + +class StoreVC: UIViewController, + UICollectionViewDelegate, UICollectionViewDataSource,UICollectionViewDelegateFlowLayout, + UISearchBarDelegate, MyCustomCellDelegator { + + func callSegueFromCell(prodIndex: IndexPath) { + performSegue(withIdentifier: "update_page", sender:prodIndex) + } + + + @IBOutlet weak var searchBar: UISearchBar! + @IBOutlet weak var picCV: UICollectionView! + + var searchedProducts: Array = productList + + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return searchedProducts.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + + let Products = searchedProducts[indexPath.item] + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "update_page", for: indexPath) as! StoreCell + + cell.setup(with: searchedProducts[indexPath.item], indexPath: indexPath) + cell.delegate = self + + return cell + + } + + + 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 collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + return CGSize( + width: self.view.frame.width * 0.45, + height: 360 + ) + } + + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + + let product = productList[indexPath.item] + + performSegue(withIdentifier: "show_order", + sender: product ) + } + + func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { + if searchText.isEmpty { + searchedProducts = productList + }else{ + searchedProducts = productList.filter({ + oneProduct in + return oneProduct.name.starts(with: searchText) + }) + } + picCV.reloadData() + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + super.prepare(for: segue, sender: sender) + if segue.identifier == "update_page" { + let updatePage = segue.destination as! EditeVC + updatePage.indexPath = sender as? IndexPath + + }else{ + let ProductVC = segue.destination as! ProductVC + ProductVC.productsFromViewController = sender as? Product + } + +} + + + + override func viewDidLoad() { + super.viewDidLoad() + + picCV.delegate = self + picCV.dataSource = self + searchBar.delegate = self + } + + + + + +} +