diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..c590013 Binary files /dev/null and b/.DS_Store differ diff --git a/CH12/.DS_Store b/CH12/.DS_Store new file mode 100644 index 0000000..76cf40a Binary files /dev/null and b/CH12/.DS_Store differ diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.pbxproj b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1c7bf14 --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.pbxproj @@ -0,0 +1,394 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 28594ABB274F82A00051EC7F /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28594ABA274F82A00051EC7F /* DetailViewController.swift */; }; + 28646085274B7D9000588B4D /* ItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28646084274B7D9000588B4D /* ItemCell.swift */; }; + 28CA90F12743BAC2007701FB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA90F02743BAC2007701FB /* AppDelegate.swift */; }; + 28CA90F32743BAC2007701FB /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA90F22743BAC2007701FB /* SceneDelegate.swift */; }; + 28CA90F82743BAC2007701FB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28CA90F62743BAC2007701FB /* Main.storyboard */; }; + 28CA90FA2743BAC3007701FB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 28CA90F92743BAC3007701FB /* Assets.xcassets */; }; + 28CA90FD2743BAC3007701FB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28CA90FB2743BAC3007701FB /* LaunchScreen.storyboard */; }; + 28CA91052743BCC0007701FB /* ItemsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA91042743BCC0007701FB /* ItemsViewController.swift */; }; + 28CA91082743BEAA007701FB /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA91072743BEAA007701FB /* Item.swift */; }; + 28CA910B2743CCED007701FB /* ItemStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA910A2743CCED007701FB /* ItemStore.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 28594ABA274F82A00051EC7F /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = ""; }; + 28646084274B7D9000588B4D /* ItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemCell.swift; sourceTree = ""; }; + 28CA90ED2743BAC2007701FB /* LootLogger-Abduaziz_hussun.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "LootLogger-Abduaziz_hussun.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 28CA90F02743BAC2007701FB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 28CA90F22743BAC2007701FB /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 28CA90F72743BAC2007701FB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 28CA90F92743BAC3007701FB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 28CA90FC2743BAC3007701FB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 28CA90FE2743BAC3007701FB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 28CA91042743BCC0007701FB /* ItemsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemsViewController.swift; sourceTree = ""; }; + 28CA91072743BEAA007701FB /* Item.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Item.swift; sourceTree = ""; }; + 28CA910A2743CCED007701FB /* ItemStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemStore.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 28CA90EA2743BAC2007701FB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 28C968B027467F9C0047103E /* Support */ = { + isa = PBXGroup; + children = ( + 28CA90F02743BAC2007701FB /* AppDelegate.swift */, + 28CA90F22743BAC2007701FB /* SceneDelegate.swift */, + 28CA90FB2743BAC3007701FB /* LaunchScreen.storyboard */, + 28CA90F92743BAC3007701FB /* Assets.xcassets */, + ); + path = Support; + sourceTree = ""; + }; + 28C968B127467FC10047103E /* View */ = { + isa = PBXGroup; + children = ( + 28CA90F62743BAC2007701FB /* Main.storyboard */, + ); + path = View; + sourceTree = ""; + }; + 28CA90E42743BAC2007701FB = { + isa = PBXGroup; + children = ( + 28CA90EF2743BAC2007701FB /* LootLogger-Abduaziz_hussun */, + 28CA90EE2743BAC2007701FB /* Products */, + ); + sourceTree = ""; + }; + 28CA90EE2743BAC2007701FB /* Products */ = { + isa = PBXGroup; + children = ( + 28CA90ED2743BAC2007701FB /* LootLogger-Abduaziz_hussun.app */, + ); + name = Products; + sourceTree = ""; + }; + 28CA90EF2743BAC2007701FB /* LootLogger-Abduaziz_hussun */ = { + isa = PBXGroup; + children = ( + 28CA91092743BEAF007701FB /* Model */, + 28CA91062743BCF0007701FB /* Controller */, + 28C968B127467FC10047103E /* View */, + 28C968B027467F9C0047103E /* Support */, + 28CA90FE2743BAC3007701FB /* Info.plist */, + ); + path = "LootLogger-Abduaziz_hussun"; + sourceTree = ""; + }; + 28CA91062743BCF0007701FB /* Controller */ = { + isa = PBXGroup; + children = ( + 28CA91042743BCC0007701FB /* ItemsViewController.swift */, + 28594ABA274F82A00051EC7F /* DetailViewController.swift */, + ); + path = Controller; + sourceTree = ""; + }; + 28CA91092743BEAF007701FB /* Model */ = { + isa = PBXGroup; + children = ( + 28CA91072743BEAA007701FB /* Item.swift */, + 28646084274B7D9000588B4D /* ItemCell.swift */, + 28CA910A2743CCED007701FB /* ItemStore.swift */, + ); + path = Model; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 28CA90EC2743BAC2007701FB /* LootLogger-Abduaziz_hussun */ = { + isa = PBXNativeTarget; + buildConfigurationList = 28CA91012743BAC3007701FB /* Build configuration list for PBXNativeTarget "LootLogger-Abduaziz_hussun" */; + buildPhases = ( + 28CA90E92743BAC2007701FB /* Sources */, + 28CA90EA2743BAC2007701FB /* Frameworks */, + 28CA90EB2743BAC2007701FB /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "LootLogger-Abduaziz_hussun"; + productName = "LootLogger-Abduaziz_hussun"; + productReference = 28CA90ED2743BAC2007701FB /* LootLogger-Abduaziz_hussun.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 28CA90E52743BAC2007701FB /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1250; + LastUpgradeCheck = 1250; + TargetAttributes = { + 28CA90EC2743BAC2007701FB = { + CreatedOnToolsVersion = 12.5; + }; + }; + }; + buildConfigurationList = 28CA90E82743BAC2007701FB /* Build configuration list for PBXProject "LootLogger-Abduaziz_hussun" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 28CA90E42743BAC2007701FB; + productRefGroup = 28CA90EE2743BAC2007701FB /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 28CA90EC2743BAC2007701FB /* LootLogger-Abduaziz_hussun */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 28CA90EB2743BAC2007701FB /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 28CA90FD2743BAC3007701FB /* LaunchScreen.storyboard in Resources */, + 28CA90FA2743BAC3007701FB /* Assets.xcassets in Resources */, + 28CA90F82743BAC2007701FB /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 28CA90E92743BAC2007701FB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 28CA91082743BEAA007701FB /* Item.swift in Sources */, + 28646085274B7D9000588B4D /* ItemCell.swift in Sources */, + 28CA91052743BCC0007701FB /* ItemsViewController.swift in Sources */, + 28CA90F12743BAC2007701FB /* AppDelegate.swift in Sources */, + 28CA910B2743CCED007701FB /* ItemStore.swift in Sources */, + 28CA90F32743BAC2007701FB /* SceneDelegate.swift in Sources */, + 28594ABB274F82A00051EC7F /* DetailViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 28CA90F62743BAC2007701FB /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 28CA90F72743BAC2007701FB /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 28CA90FB2743BAC3007701FB /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 28CA90FC2743BAC3007701FB /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 28CA90FF2743BAC3007701FB /* 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++14"; + 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 = 14.5; + 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; + }; + 28CA91002743BAC3007701FB /* 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++14"; + 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 = 14.5; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 28CA91022743BAC3007701FB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = X962KR4KLP; + INFOPLIST_FILE = "LootLogger-Abduaziz_hussun/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "azooz.LootLogger-Abduaziz-hussun"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 28CA91032743BAC3007701FB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = X962KR4KLP; + INFOPLIST_FILE = "LootLogger-Abduaziz_hussun/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "azooz.LootLogger-Abduaziz-hussun"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 28CA90E82743BAC2007701FB /* Build configuration list for PBXProject "LootLogger-Abduaziz_hussun" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 28CA90FF2743BAC3007701FB /* Debug */, + 28CA91002743BAC3007701FB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 28CA91012743BAC3007701FB /* Build configuration list for PBXNativeTarget "LootLogger-Abduaziz_hussun" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 28CA91022743BAC3007701FB /* Debug */, + 28CA91032743BAC3007701FB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 28CA90E52743BAC2007701FB /* Project object */; +} diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/.DS_Store b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/.DS_Store new file mode 100644 index 0000000..0a9b47d Binary files /dev/null and b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/.DS_Store differ diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Controller/DetailViewController.swift b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Controller/DetailViewController.swift new file mode 100644 index 0000000..70b9884 --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Controller/DetailViewController.swift @@ -0,0 +1,87 @@ +// +// DetailViewController.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 25/11/2021. +// + +import UIKit +class DetailViewController: UIViewController { + + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + textField.resignFirstResponder() + return true } + + + + @IBOutlet weak var nameField: UITextField! + + @IBOutlet weak var serialNumberField: UITextField! + + + @IBOutlet weak var valueField: UITextField! + + @IBOutlet weak var dateLabel: UILabel! + + + + + + var item: Item! { didSet { + navigationItem.title = item.name +} +} + + let numberFormatter: NumberFormatter = { + let formatter = NumberFormatter() + formatter.numberStyle = .decimal + formatter.minimumFractionDigits = 2 + formatter.maximumFractionDigits = 2 + return formatter + }() + + let dateFormatter: DateFormatter = { + let formatter = DateFormatter() + formatter.dateStyle = .medium + formatter.timeStyle = .none + return formatter + }() + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + nameField.text = item.name + serialNumberField.text = item.serialNumber + valueField.text = numberFormatter.string(from: NSNumber(value: item.valueInDollars)) + dateLabel.text = dateFormatter.string(from: item.dateCreated) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + // "Save" changes to item + item.name = nameField.text ?? "" + item.serialNumber = serialNumberField.text + if let valueText = valueField.text, + let value = numberFormatter.number(from: valueText) { + item.valueInDollars = value.intValue + } else { + item.valueInDollars = 0 + } + } + + + + @IBAction func backgroundTappe(_ sender: UITapGestureRecognizer) { + // Clear first responder + view.endEditing(true) + // "Save" changes to item + item.name = nameField.text ?? "" + item.serialNumber = serialNumberField.text + if let valueText = valueField.text, + let value = numberFormatter.number(from: valueText) { + item.valueInDollars = value.intValue + } else { + item.valueInDollars = 0 + } + } +} diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Controller/ItemsViewController.swift b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Controller/ItemsViewController.swift new file mode 100644 index 0000000..f56481d --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Controller/ItemsViewController.swift @@ -0,0 +1,175 @@ +// +// ItemsViewController.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import UIKit + +class ItemsViewController: UITableViewController { + + var itemStore: ItemStore! + override func tableView(_ tableView: UITableView,//تفعيل الحذف لي Edit + commit editingStyle: UITableViewCell.EditingStyle, + forRowAt indexPath: IndexPath) { + // If the table view is asking to commit a delete command... + if editingStyle == .delete { + let item = itemStore.allItems[indexPath.row] + // Remove the item from the store + itemStore.removeItem(item) + // Also remove that row from the table view with an animation + tableView.deleteRows(at: [indexPath], with: .automatic) + } + } + @IBAction func toggleEditingMode(_ sender: UIButton) { + // If you are currently in editing mode... + if isEditing { + // Change text of button to inform user of state + sender.setTitle("Edit", for: .normal) + // Turn off editing mode + setEditing(false, animated: true) + } else { + // Change text of button to inform user of state + sender.setTitle("Done", for: .normal) + // Enter editing mode + setEditing(true, animated: true) + } + } + @IBAction func addNewItem(_ sender: UIButton) { + // Create a new item and add it to the store + let newItem = itemStore.createItem() + + // Figure out where that item is in the array + if let index = itemStore.allItems.firstIndex(of: newItem) { + let indexPath = IndexPath(row: index, section: 0) + // Insert this new row into the table + tableView.insertRows(at: [indexPath], with: .automatic) + } + } + override func viewDidLoad() { + super.viewDidLoad() + tableView.rowHeight = UITableView.automaticDimension + tableView.estimatedRowHeight = 65 + // Uncomment the following line to preserve selection between presentations + // self.clearsSelectionOnViewWillAppear = false + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem + }//اظافت قامت خيرات في كل سطر وتستطيع التحكم في مكان الصف وتحريكه الى الاعلا + override func tableView(_ tableView: UITableView, + moveRowAt sourceIndexPath: IndexPath, + // Update the model + to destinationIndexPath: IndexPath) { + itemStore.moveItem(from: sourceIndexPath.row, to: destinationIndexPath.row) + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // If the triggered segue is the "showItem" segue + switch segue.identifier { + case "showItem": + // Figure out which row was just tapped + if let row = tableView.indexPathForSelectedRow?.row { + // Get the item associated with this row and pass it along + let item = itemStore.allItems[row] + let detailViewController + = segue.destination as! DetailViewController + detailViewController.item = item + } + default: + preconditionFailure("Unexpected segue identifier.") + } + } + + + // MARK: - Table view data source + +// override func numberOfSections(in tableView: UITableView) -> Int { +// // #warning Incomplete implementation, return the number of sections +// return 0 +// } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + tableView.reloadData() + } + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of rows + return itemStore.allItems.count + } + + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { +// let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath) + + // Get a new or recycled cell + let cell = tableView.dequeueReusableCell(withIdentifier: "ItemCell", + for: indexPath) as! ItemCell + + // Set the text on the cell with the description of the item + // that is at the nth index of items, where n = row this cell + // will appear in on the tableview + let item = itemStore.allItems[indexPath.row] + + // Configure the cell with the Item + cell.nameLabel.text = item.name + cell.serialNumberLabel.text = item.serialNumber + cell.valueLabel.text = "$\(item.valueInDollars)" + + + + + return cell + } + + + } + + + + /* + // Override to support conditional editing of the table view. + override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the specified item to be editable. + return true + } + */ + + /* + // Override to support editing the table view. + override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { + if editingStyle == .delete { + // Delete the row from the data source + tableView.deleteRows(at: [indexPath], with: .fade) + } else if editingStyle == .insert { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } + } + */ + + /* + // Override to support rearranging the table view. + override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) { + + } + */ + + /* + // Override to support conditional rearranging of the table view. + override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the item to be re-orderable. + return true + } + */ + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + + diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Info.plist b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Info.plist new file mode 100644 index 0000000..da3eb36 --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Info.plist @@ -0,0 +1,66 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + Main + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/Item.swift b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/Item.swift new file mode 100644 index 0000000..ba10a34 --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/Item.swift @@ -0,0 +1,59 @@ +// +// Item.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import Foundation + +class Item: Equatable { + var name: String + var valueInDollars: Int + var serialNumber: String? + var dateCreated: Date + + static func ==(lhs: Item, rhs: Item) -> Bool { + + return lhs.name == rhs.name + && lhs.serialNumber == rhs.serialNumber + && lhs.valueInDollars == rhs.valueInDollars + && lhs.dateCreated == rhs.dateCreated + } + + + init(name: String, + serialNumber: String?, + valueInDollars: Int) { + self.name = name + self.valueInDollars = valueInDollars + self.serialNumber = serialNumber + self.dateCreated = Date() + } + + convenience init(random: Bool = false) { + if random { + let adjectives = ["Fluffy", "Rusty", "Shiny"] + let nouns = ["Bear", "Spork", "Mac"] + + let randomAdjective = adjectives.randomElement()! + let randomNoun = nouns.randomElement()! + + let randomName = "\(randomAdjective) \(randomNoun)" + let randomValue = Int.random(in: 0..<100) + + let randomSerialNumber = + UUID().uuidString.components(separatedBy: "-").first! + + self.init(name: randomName, + serialNumber: randomSerialNumber, + valueInDollars: randomValue) + } else { + self.init(name: "", + serialNumber: nil, + valueInDollars: 0) + } + + } + +} diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/ItemCell.swift b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/ItemCell.swift new file mode 100644 index 0000000..0734782 --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/ItemCell.swift @@ -0,0 +1,26 @@ +// +// File.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 17/04/1443 AH. +// + +import UIKit +class ItemCell: UITableViewCell { + + + + + + + + @IBOutlet var nameLabel: UILabel! + + + @IBOutlet var serialNumberLabel: UILabel! + + + @IBOutlet var valueLabel: UILabel! + + +} diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/ItemStore.swift b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/ItemStore.swift new file mode 100644 index 0000000..e11015b --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/ItemStore.swift @@ -0,0 +1,42 @@ +// +// ItemStore.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import Foundation +//متجر العناصرItemStore +class ItemStore { + var allItems = [Item]() + +// init() { +// for _ in 0..<6 { //عدد العناصر في المصفوفه +// createItem() +// } +// } + //انشاء عنصرcreateItem + @discardableResult func createItem() -> Item { + let newItem = Item(random: true) + //اظافهappend + allItems.append(newItem) + return newItem + } + + func removeItem(_ item: Item) { + if let index = allItems.firstIndex(of: item) { + allItems.remove(at: index) + } + } + func moveItem(from fromIndex: Int, to toIndex: Int) { + if fromIndex == toIndex { + return } + // Get reference to object being moved so you can reinsert it + let movedItem = allItems[fromIndex] + // Remove item from array + allItems.remove(at: fromIndex) + // Insert item in array at new location + allItems.insert(movedItem, at: toIndex) + } + +} diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/.DS_Store b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/.DS_Store new file mode 100644 index 0000000..0b089ae Binary files /dev/null and b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/.DS_Store differ diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/AppDelegate.swift b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/AppDelegate.swift new file mode 100644 index 0000000..fc10ec3 --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/AppDelegate.swift @@ -0,0 +1,36 @@ +// +// AppDelegate.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/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/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AccentColor.colorset/Contents.json b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AppIcon.appiconset/Contents.json b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/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/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/Contents.json b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Base.lproj/LaunchScreen.storyboard b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/SceneDelegate.swift b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/SceneDelegate.swift new file mode 100644 index 0000000..8d4acc1 --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/SceneDelegate.swift @@ -0,0 +1,64 @@ +// +// SceneDelegate.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + + + func scene(_ scene: UIScene, + willConnectTo session: UISceneSession, + options connectionOptions: UIScene.ConnectionOptions) { + guard let _ = (scene as? UIWindowScene) else { return } + // Create an ItemStore + + // 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 } + + let itemStore = ItemStore() + + let navController = window!.rootViewController as! UINavigationController + let itemsController = navController.topViewController as! ItemsViewController;itemsController.itemStore = itemStore + } + + 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/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/View/Base.lproj/Main.storyboard b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/View/Base.lproj/Main.storyboard new file mode 100644 index 0000000..e6c25cd --- /dev/null +++ b/CH12/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/View/Base.lproj/Main.storyboard @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CH13/.DS_Store b/CH13/.DS_Store new file mode 100644 index 0000000..792f1d5 Binary files /dev/null and b/CH13/.DS_Store differ diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun.xcodeproj/project.pbxproj b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1c7bf14 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun.xcodeproj/project.pbxproj @@ -0,0 +1,394 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 28594ABB274F82A00051EC7F /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28594ABA274F82A00051EC7F /* DetailViewController.swift */; }; + 28646085274B7D9000588B4D /* ItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28646084274B7D9000588B4D /* ItemCell.swift */; }; + 28CA90F12743BAC2007701FB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA90F02743BAC2007701FB /* AppDelegate.swift */; }; + 28CA90F32743BAC2007701FB /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA90F22743BAC2007701FB /* SceneDelegate.swift */; }; + 28CA90F82743BAC2007701FB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28CA90F62743BAC2007701FB /* Main.storyboard */; }; + 28CA90FA2743BAC3007701FB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 28CA90F92743BAC3007701FB /* Assets.xcassets */; }; + 28CA90FD2743BAC3007701FB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28CA90FB2743BAC3007701FB /* LaunchScreen.storyboard */; }; + 28CA91052743BCC0007701FB /* ItemsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA91042743BCC0007701FB /* ItemsViewController.swift */; }; + 28CA91082743BEAA007701FB /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA91072743BEAA007701FB /* Item.swift */; }; + 28CA910B2743CCED007701FB /* ItemStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA910A2743CCED007701FB /* ItemStore.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 28594ABA274F82A00051EC7F /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = ""; }; + 28646084274B7D9000588B4D /* ItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemCell.swift; sourceTree = ""; }; + 28CA90ED2743BAC2007701FB /* LootLogger-Abduaziz_hussun.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "LootLogger-Abduaziz_hussun.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 28CA90F02743BAC2007701FB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 28CA90F22743BAC2007701FB /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 28CA90F72743BAC2007701FB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 28CA90F92743BAC3007701FB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 28CA90FC2743BAC3007701FB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 28CA90FE2743BAC3007701FB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 28CA91042743BCC0007701FB /* ItemsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemsViewController.swift; sourceTree = ""; }; + 28CA91072743BEAA007701FB /* Item.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Item.swift; sourceTree = ""; }; + 28CA910A2743CCED007701FB /* ItemStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemStore.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 28CA90EA2743BAC2007701FB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 28C968B027467F9C0047103E /* Support */ = { + isa = PBXGroup; + children = ( + 28CA90F02743BAC2007701FB /* AppDelegate.swift */, + 28CA90F22743BAC2007701FB /* SceneDelegate.swift */, + 28CA90FB2743BAC3007701FB /* LaunchScreen.storyboard */, + 28CA90F92743BAC3007701FB /* Assets.xcassets */, + ); + path = Support; + sourceTree = ""; + }; + 28C968B127467FC10047103E /* View */ = { + isa = PBXGroup; + children = ( + 28CA90F62743BAC2007701FB /* Main.storyboard */, + ); + path = View; + sourceTree = ""; + }; + 28CA90E42743BAC2007701FB = { + isa = PBXGroup; + children = ( + 28CA90EF2743BAC2007701FB /* LootLogger-Abduaziz_hussun */, + 28CA90EE2743BAC2007701FB /* Products */, + ); + sourceTree = ""; + }; + 28CA90EE2743BAC2007701FB /* Products */ = { + isa = PBXGroup; + children = ( + 28CA90ED2743BAC2007701FB /* LootLogger-Abduaziz_hussun.app */, + ); + name = Products; + sourceTree = ""; + }; + 28CA90EF2743BAC2007701FB /* LootLogger-Abduaziz_hussun */ = { + isa = PBXGroup; + children = ( + 28CA91092743BEAF007701FB /* Model */, + 28CA91062743BCF0007701FB /* Controller */, + 28C968B127467FC10047103E /* View */, + 28C968B027467F9C0047103E /* Support */, + 28CA90FE2743BAC3007701FB /* Info.plist */, + ); + path = "LootLogger-Abduaziz_hussun"; + sourceTree = ""; + }; + 28CA91062743BCF0007701FB /* Controller */ = { + isa = PBXGroup; + children = ( + 28CA91042743BCC0007701FB /* ItemsViewController.swift */, + 28594ABA274F82A00051EC7F /* DetailViewController.swift */, + ); + path = Controller; + sourceTree = ""; + }; + 28CA91092743BEAF007701FB /* Model */ = { + isa = PBXGroup; + children = ( + 28CA91072743BEAA007701FB /* Item.swift */, + 28646084274B7D9000588B4D /* ItemCell.swift */, + 28CA910A2743CCED007701FB /* ItemStore.swift */, + ); + path = Model; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 28CA90EC2743BAC2007701FB /* LootLogger-Abduaziz_hussun */ = { + isa = PBXNativeTarget; + buildConfigurationList = 28CA91012743BAC3007701FB /* Build configuration list for PBXNativeTarget "LootLogger-Abduaziz_hussun" */; + buildPhases = ( + 28CA90E92743BAC2007701FB /* Sources */, + 28CA90EA2743BAC2007701FB /* Frameworks */, + 28CA90EB2743BAC2007701FB /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "LootLogger-Abduaziz_hussun"; + productName = "LootLogger-Abduaziz_hussun"; + productReference = 28CA90ED2743BAC2007701FB /* LootLogger-Abduaziz_hussun.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 28CA90E52743BAC2007701FB /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1250; + LastUpgradeCheck = 1250; + TargetAttributes = { + 28CA90EC2743BAC2007701FB = { + CreatedOnToolsVersion = 12.5; + }; + }; + }; + buildConfigurationList = 28CA90E82743BAC2007701FB /* Build configuration list for PBXProject "LootLogger-Abduaziz_hussun" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 28CA90E42743BAC2007701FB; + productRefGroup = 28CA90EE2743BAC2007701FB /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 28CA90EC2743BAC2007701FB /* LootLogger-Abduaziz_hussun */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 28CA90EB2743BAC2007701FB /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 28CA90FD2743BAC3007701FB /* LaunchScreen.storyboard in Resources */, + 28CA90FA2743BAC3007701FB /* Assets.xcassets in Resources */, + 28CA90F82743BAC2007701FB /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 28CA90E92743BAC2007701FB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 28CA91082743BEAA007701FB /* Item.swift in Sources */, + 28646085274B7D9000588B4D /* ItemCell.swift in Sources */, + 28CA91052743BCC0007701FB /* ItemsViewController.swift in Sources */, + 28CA90F12743BAC2007701FB /* AppDelegate.swift in Sources */, + 28CA910B2743CCED007701FB /* ItemStore.swift in Sources */, + 28CA90F32743BAC2007701FB /* SceneDelegate.swift in Sources */, + 28594ABB274F82A00051EC7F /* DetailViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 28CA90F62743BAC2007701FB /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 28CA90F72743BAC2007701FB /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 28CA90FB2743BAC3007701FB /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 28CA90FC2743BAC3007701FB /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 28CA90FF2743BAC3007701FB /* 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++14"; + 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 = 14.5; + 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; + }; + 28CA91002743BAC3007701FB /* 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++14"; + 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 = 14.5; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 28CA91022743BAC3007701FB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = X962KR4KLP; + INFOPLIST_FILE = "LootLogger-Abduaziz_hussun/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "azooz.LootLogger-Abduaziz-hussun"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 28CA91032743BAC3007701FB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = X962KR4KLP; + INFOPLIST_FILE = "LootLogger-Abduaziz_hussun/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "azooz.LootLogger-Abduaziz-hussun"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 28CA90E82743BAC2007701FB /* Build configuration list for PBXProject "LootLogger-Abduaziz_hussun" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 28CA90FF2743BAC3007701FB /* Debug */, + 28CA91002743BAC3007701FB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 28CA91012743BAC3007701FB /* Build configuration list for PBXNativeTarget "LootLogger-Abduaziz_hussun" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 28CA91022743BAC3007701FB /* Debug */, + 28CA91032743BAC3007701FB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 28CA90E52743BAC2007701FB /* Project object */; +} diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/.DS_Store b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/.DS_Store new file mode 100644 index 0000000..0a9b47d Binary files /dev/null and b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/.DS_Store differ diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Controller/DetailViewController.swift b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Controller/DetailViewController.swift new file mode 100644 index 0000000..70b9884 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Controller/DetailViewController.swift @@ -0,0 +1,87 @@ +// +// DetailViewController.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 25/11/2021. +// + +import UIKit +class DetailViewController: UIViewController { + + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + textField.resignFirstResponder() + return true } + + + + @IBOutlet weak var nameField: UITextField! + + @IBOutlet weak var serialNumberField: UITextField! + + + @IBOutlet weak var valueField: UITextField! + + @IBOutlet weak var dateLabel: UILabel! + + + + + + var item: Item! { didSet { + navigationItem.title = item.name +} +} + + let numberFormatter: NumberFormatter = { + let formatter = NumberFormatter() + formatter.numberStyle = .decimal + formatter.minimumFractionDigits = 2 + formatter.maximumFractionDigits = 2 + return formatter + }() + + let dateFormatter: DateFormatter = { + let formatter = DateFormatter() + formatter.dateStyle = .medium + formatter.timeStyle = .none + return formatter + }() + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + nameField.text = item.name + serialNumberField.text = item.serialNumber + valueField.text = numberFormatter.string(from: NSNumber(value: item.valueInDollars)) + dateLabel.text = dateFormatter.string(from: item.dateCreated) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + // "Save" changes to item + item.name = nameField.text ?? "" + item.serialNumber = serialNumberField.text + if let valueText = valueField.text, + let value = numberFormatter.number(from: valueText) { + item.valueInDollars = value.intValue + } else { + item.valueInDollars = 0 + } + } + + + + @IBAction func backgroundTappe(_ sender: UITapGestureRecognizer) { + // Clear first responder + view.endEditing(true) + // "Save" changes to item + item.name = nameField.text ?? "" + item.serialNumber = serialNumberField.text + if let valueText = valueField.text, + let value = numberFormatter.number(from: valueText) { + item.valueInDollars = value.intValue + } else { + item.valueInDollars = 0 + } + } +} diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Controller/ItemsViewController.swift b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Controller/ItemsViewController.swift new file mode 100644 index 0000000..f56481d --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Controller/ItemsViewController.swift @@ -0,0 +1,175 @@ +// +// ItemsViewController.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import UIKit + +class ItemsViewController: UITableViewController { + + var itemStore: ItemStore! + override func tableView(_ tableView: UITableView,//تفعيل الحذف لي Edit + commit editingStyle: UITableViewCell.EditingStyle, + forRowAt indexPath: IndexPath) { + // If the table view is asking to commit a delete command... + if editingStyle == .delete { + let item = itemStore.allItems[indexPath.row] + // Remove the item from the store + itemStore.removeItem(item) + // Also remove that row from the table view with an animation + tableView.deleteRows(at: [indexPath], with: .automatic) + } + } + @IBAction func toggleEditingMode(_ sender: UIButton) { + // If you are currently in editing mode... + if isEditing { + // Change text of button to inform user of state + sender.setTitle("Edit", for: .normal) + // Turn off editing mode + setEditing(false, animated: true) + } else { + // Change text of button to inform user of state + sender.setTitle("Done", for: .normal) + // Enter editing mode + setEditing(true, animated: true) + } + } + @IBAction func addNewItem(_ sender: UIButton) { + // Create a new item and add it to the store + let newItem = itemStore.createItem() + + // Figure out where that item is in the array + if let index = itemStore.allItems.firstIndex(of: newItem) { + let indexPath = IndexPath(row: index, section: 0) + // Insert this new row into the table + tableView.insertRows(at: [indexPath], with: .automatic) + } + } + override func viewDidLoad() { + super.viewDidLoad() + tableView.rowHeight = UITableView.automaticDimension + tableView.estimatedRowHeight = 65 + // Uncomment the following line to preserve selection between presentations + // self.clearsSelectionOnViewWillAppear = false + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem + }//اظافت قامت خيرات في كل سطر وتستطيع التحكم في مكان الصف وتحريكه الى الاعلا + override func tableView(_ tableView: UITableView, + moveRowAt sourceIndexPath: IndexPath, + // Update the model + to destinationIndexPath: IndexPath) { + itemStore.moveItem(from: sourceIndexPath.row, to: destinationIndexPath.row) + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // If the triggered segue is the "showItem" segue + switch segue.identifier { + case "showItem": + // Figure out which row was just tapped + if let row = tableView.indexPathForSelectedRow?.row { + // Get the item associated with this row and pass it along + let item = itemStore.allItems[row] + let detailViewController + = segue.destination as! DetailViewController + detailViewController.item = item + } + default: + preconditionFailure("Unexpected segue identifier.") + } + } + + + // MARK: - Table view data source + +// override func numberOfSections(in tableView: UITableView) -> Int { +// // #warning Incomplete implementation, return the number of sections +// return 0 +// } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + tableView.reloadData() + } + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of rows + return itemStore.allItems.count + } + + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { +// let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath) + + // Get a new or recycled cell + let cell = tableView.dequeueReusableCell(withIdentifier: "ItemCell", + for: indexPath) as! ItemCell + + // Set the text on the cell with the description of the item + // that is at the nth index of items, where n = row this cell + // will appear in on the tableview + let item = itemStore.allItems[indexPath.row] + + // Configure the cell with the Item + cell.nameLabel.text = item.name + cell.serialNumberLabel.text = item.serialNumber + cell.valueLabel.text = "$\(item.valueInDollars)" + + + + + return cell + } + + + } + + + + /* + // Override to support conditional editing of the table view. + override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the specified item to be editable. + return true + } + */ + + /* + // Override to support editing the table view. + override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { + if editingStyle == .delete { + // Delete the row from the data source + tableView.deleteRows(at: [indexPath], with: .fade) + } else if editingStyle == .insert { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } + } + */ + + /* + // Override to support rearranging the table view. + override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) { + + } + */ + + /* + // Override to support conditional rearranging of the table view. + override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the item to be re-orderable. + return true + } + */ + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + + diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Info.plist b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Info.plist new file mode 100644 index 0000000..da3eb36 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Info.plist @@ -0,0 +1,66 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + Main + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Model/Item.swift b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Model/Item.swift new file mode 100644 index 0000000..d555a15 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Model/Item.swift @@ -0,0 +1,61 @@ +// +// Item.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import Foundation + +class Item: Equatable, Codable { + + + var name: String + var valueInDollars: Int + var serialNumber: String? + var dateCreated: Date + + static func ==(lhs: Item, rhs: Item) -> Bool { + + return lhs.name == rhs.name + && lhs.serialNumber == rhs.serialNumber + && lhs.valueInDollars == rhs.valueInDollars + && lhs.dateCreated == rhs.dateCreated + } + + + init(name: String, + serialNumber: String?, + valueInDollars: Int) { + self.name = name + self.valueInDollars = valueInDollars + self.serialNumber = serialNumber + self.dateCreated = Date() + } + + convenience init(random: Bool = false) { + if random { + let adjectives = ["Fluffy", "Rusty", "Shiny"] + let nouns = ["Bear", "Spork", "Mac"] + + let randomAdjective = adjectives.randomElement()! + let randomNoun = nouns.randomElement()! + + let randomName = "\(randomAdjective) \(randomNoun)" + let randomValue = Int.random(in: 0..<100) + + let randomSerialNumber = + UUID().uuidString.components(separatedBy: "-").first! + + self.init(name: randomName, + serialNumber: randomSerialNumber, + valueInDollars: randomValue) + } else { + self.init(name: "", + serialNumber: nil, + valueInDollars: 0) + } + + } + +} diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Model/ItemCell.swift b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Model/ItemCell.swift new file mode 100644 index 0000000..0734782 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Model/ItemCell.swift @@ -0,0 +1,26 @@ +// +// File.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 17/04/1443 AH. +// + +import UIKit +class ItemCell: UITableViewCell { + + + + + + + + @IBOutlet var nameLabel: UILabel! + + + @IBOutlet var serialNumberLabel: UILabel! + + + @IBOutlet var valueLabel: UILabel! + + +} diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Model/ItemStore.swift b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Model/ItemStore.swift new file mode 100644 index 0000000..39bbcaa --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Model/ItemStore.swift @@ -0,0 +1,98 @@ +// +// ItemStore.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import UIKit +//متجر العناصرItemStore + +class ItemStore { + enum Error:Swift.Error { + case encodingError,writingError + } + var allItems = [Item]() + let itemArchiveURL: URL = { + let documentsDirectories = + FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) + let documentDirectory = documentsDirectories.first! + return documentDirectory.appendingPathComponent("items.plist") + }() + + + init() { + do { + let data = try Data(contentsOf: itemArchiveURL) + let unarchiver = PropertyListDecoder() + let items = try unarchiver.decode([Item].self, from: data) + allItems = items + + let notificationCenter = NotificationCenter.default + notificationCenter.addObserver(self, + selector: #selector(saveChanges), + name: UIScene.didEnterBackgroundNotification, + object: nil) + } catch (let error) { + print("Error reading in saved items: \(error)") + } + } +// init() { +// for _ in 0..<6 { //عدد العناصر في المصفوفه +// createItem() +// } +// } + //انشاء عنصرcreateItem + @discardableResult func createItem() -> Item { + let newItem = Item(random: true) + //اظافهappend + allItems.append(newItem) + return newItem + } + + + + func removeItem(_ item: Item) { + if let index = allItems.firstIndex(of: item) { + allItems.remove(at: index) + } + } + + func moveItem(from fromIndex: Int, to toIndex: Int) { + if fromIndex == toIndex { + return } + // Get reference to object being moved so you can reinsert it + let movedItem = allItems[fromIndex] + // Remove item from array + allItems.remove(at: fromIndex) + // Insert item in array at new location + allItems.insert(movedItem, at: toIndex) + } + + + @objc func saveChanges () { + do { + try archiveChanges () + } catch Error.encodingError { + print("Couldn't encode items.") + } catch Error.writingError { + print("Couldn't write to file.") + } catch (let error){ + print("Error: \(error)") + } + } + + func archiveChanges () throws { + print("Saving items to: \(itemArchiveURL)") + let encoder = PropertyListEncoder() + + guard let data = try? encoder.encode(allItems) else { + throw ItemStore.Error.encodingError + } + guard let _ = try? data.write(to: itemArchiveURL, options: [.atomic]) else { + throw ItemStore.Error.writingError + } + print ("Saved all of the items") + } +} + diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/.DS_Store b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/.DS_Store new file mode 100644 index 0000000..0b089ae Binary files /dev/null and b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/.DS_Store differ diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/AppDelegate.swift b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/AppDelegate.swift new file mode 100644 index 0000000..fc10ec3 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/AppDelegate.swift @@ -0,0 +1,36 @@ +// +// AppDelegate.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/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/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AccentColor.colorset/Contents.json b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AppIcon.appiconset/Contents.json b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/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/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/Contents.json b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/Base.lproj/LaunchScreen.storyboard b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/SceneDelegate.swift b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/SceneDelegate.swift new file mode 100644 index 0000000..8d4acc1 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/Support/SceneDelegate.swift @@ -0,0 +1,64 @@ +// +// SceneDelegate.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + + + func scene(_ scene: UIScene, + willConnectTo session: UISceneSession, + options connectionOptions: UIScene.ConnectionOptions) { + guard let _ = (scene as? UIWindowScene) else { return } + // Create an ItemStore + + // 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 } + + let itemStore = ItemStore() + + let navController = window!.rootViewController as! UINavigationController + let itemsController = navController.topViewController as! ItemsViewController;itemsController.itemStore = itemStore + } + + 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/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/View/Base.lproj/Main.storyboard b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/View/Base.lproj/Main.storyboard new file mode 100644 index 0000000..e6c25cd --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Bronze/LootLogger-Abduaziz_hussun/View/Base.lproj/Main.storyboard @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun.xcodeproj/project.pbxproj b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1c7bf14 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun.xcodeproj/project.pbxproj @@ -0,0 +1,394 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 28594ABB274F82A00051EC7F /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28594ABA274F82A00051EC7F /* DetailViewController.swift */; }; + 28646085274B7D9000588B4D /* ItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28646084274B7D9000588B4D /* ItemCell.swift */; }; + 28CA90F12743BAC2007701FB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA90F02743BAC2007701FB /* AppDelegate.swift */; }; + 28CA90F32743BAC2007701FB /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA90F22743BAC2007701FB /* SceneDelegate.swift */; }; + 28CA90F82743BAC2007701FB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28CA90F62743BAC2007701FB /* Main.storyboard */; }; + 28CA90FA2743BAC3007701FB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 28CA90F92743BAC3007701FB /* Assets.xcassets */; }; + 28CA90FD2743BAC3007701FB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28CA90FB2743BAC3007701FB /* LaunchScreen.storyboard */; }; + 28CA91052743BCC0007701FB /* ItemsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA91042743BCC0007701FB /* ItemsViewController.swift */; }; + 28CA91082743BEAA007701FB /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA91072743BEAA007701FB /* Item.swift */; }; + 28CA910B2743CCED007701FB /* ItemStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA910A2743CCED007701FB /* ItemStore.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 28594ABA274F82A00051EC7F /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = ""; }; + 28646084274B7D9000588B4D /* ItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemCell.swift; sourceTree = ""; }; + 28CA90ED2743BAC2007701FB /* LootLogger-Abduaziz_hussun.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "LootLogger-Abduaziz_hussun.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 28CA90F02743BAC2007701FB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 28CA90F22743BAC2007701FB /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 28CA90F72743BAC2007701FB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 28CA90F92743BAC3007701FB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 28CA90FC2743BAC3007701FB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 28CA90FE2743BAC3007701FB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 28CA91042743BCC0007701FB /* ItemsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemsViewController.swift; sourceTree = ""; }; + 28CA91072743BEAA007701FB /* Item.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Item.swift; sourceTree = ""; }; + 28CA910A2743CCED007701FB /* ItemStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemStore.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 28CA90EA2743BAC2007701FB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 28C968B027467F9C0047103E /* Support */ = { + isa = PBXGroup; + children = ( + 28CA90F02743BAC2007701FB /* AppDelegate.swift */, + 28CA90F22743BAC2007701FB /* SceneDelegate.swift */, + 28CA90FB2743BAC3007701FB /* LaunchScreen.storyboard */, + 28CA90F92743BAC3007701FB /* Assets.xcassets */, + ); + path = Support; + sourceTree = ""; + }; + 28C968B127467FC10047103E /* View */ = { + isa = PBXGroup; + children = ( + 28CA90F62743BAC2007701FB /* Main.storyboard */, + ); + path = View; + sourceTree = ""; + }; + 28CA90E42743BAC2007701FB = { + isa = PBXGroup; + children = ( + 28CA90EF2743BAC2007701FB /* LootLogger-Abduaziz_hussun */, + 28CA90EE2743BAC2007701FB /* Products */, + ); + sourceTree = ""; + }; + 28CA90EE2743BAC2007701FB /* Products */ = { + isa = PBXGroup; + children = ( + 28CA90ED2743BAC2007701FB /* LootLogger-Abduaziz_hussun.app */, + ); + name = Products; + sourceTree = ""; + }; + 28CA90EF2743BAC2007701FB /* LootLogger-Abduaziz_hussun */ = { + isa = PBXGroup; + children = ( + 28CA91092743BEAF007701FB /* Model */, + 28CA91062743BCF0007701FB /* Controller */, + 28C968B127467FC10047103E /* View */, + 28C968B027467F9C0047103E /* Support */, + 28CA90FE2743BAC3007701FB /* Info.plist */, + ); + path = "LootLogger-Abduaziz_hussun"; + sourceTree = ""; + }; + 28CA91062743BCF0007701FB /* Controller */ = { + isa = PBXGroup; + children = ( + 28CA91042743BCC0007701FB /* ItemsViewController.swift */, + 28594ABA274F82A00051EC7F /* DetailViewController.swift */, + ); + path = Controller; + sourceTree = ""; + }; + 28CA91092743BEAF007701FB /* Model */ = { + isa = PBXGroup; + children = ( + 28CA91072743BEAA007701FB /* Item.swift */, + 28646084274B7D9000588B4D /* ItemCell.swift */, + 28CA910A2743CCED007701FB /* ItemStore.swift */, + ); + path = Model; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 28CA90EC2743BAC2007701FB /* LootLogger-Abduaziz_hussun */ = { + isa = PBXNativeTarget; + buildConfigurationList = 28CA91012743BAC3007701FB /* Build configuration list for PBXNativeTarget "LootLogger-Abduaziz_hussun" */; + buildPhases = ( + 28CA90E92743BAC2007701FB /* Sources */, + 28CA90EA2743BAC2007701FB /* Frameworks */, + 28CA90EB2743BAC2007701FB /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "LootLogger-Abduaziz_hussun"; + productName = "LootLogger-Abduaziz_hussun"; + productReference = 28CA90ED2743BAC2007701FB /* LootLogger-Abduaziz_hussun.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 28CA90E52743BAC2007701FB /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1250; + LastUpgradeCheck = 1250; + TargetAttributes = { + 28CA90EC2743BAC2007701FB = { + CreatedOnToolsVersion = 12.5; + }; + }; + }; + buildConfigurationList = 28CA90E82743BAC2007701FB /* Build configuration list for PBXProject "LootLogger-Abduaziz_hussun" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 28CA90E42743BAC2007701FB; + productRefGroup = 28CA90EE2743BAC2007701FB /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 28CA90EC2743BAC2007701FB /* LootLogger-Abduaziz_hussun */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 28CA90EB2743BAC2007701FB /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 28CA90FD2743BAC3007701FB /* LaunchScreen.storyboard in Resources */, + 28CA90FA2743BAC3007701FB /* Assets.xcassets in Resources */, + 28CA90F82743BAC2007701FB /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 28CA90E92743BAC2007701FB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 28CA91082743BEAA007701FB /* Item.swift in Sources */, + 28646085274B7D9000588B4D /* ItemCell.swift in Sources */, + 28CA91052743BCC0007701FB /* ItemsViewController.swift in Sources */, + 28CA90F12743BAC2007701FB /* AppDelegate.swift in Sources */, + 28CA910B2743CCED007701FB /* ItemStore.swift in Sources */, + 28CA90F32743BAC2007701FB /* SceneDelegate.swift in Sources */, + 28594ABB274F82A00051EC7F /* DetailViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 28CA90F62743BAC2007701FB /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 28CA90F72743BAC2007701FB /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 28CA90FB2743BAC3007701FB /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 28CA90FC2743BAC3007701FB /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 28CA90FF2743BAC3007701FB /* 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++14"; + 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 = 14.5; + 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; + }; + 28CA91002743BAC3007701FB /* 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++14"; + 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 = 14.5; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 28CA91022743BAC3007701FB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = X962KR4KLP; + INFOPLIST_FILE = "LootLogger-Abduaziz_hussun/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "azooz.LootLogger-Abduaziz-hussun"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 28CA91032743BAC3007701FB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = X962KR4KLP; + INFOPLIST_FILE = "LootLogger-Abduaziz_hussun/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "azooz.LootLogger-Abduaziz-hussun"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 28CA90E82743BAC2007701FB /* Build configuration list for PBXProject "LootLogger-Abduaziz_hussun" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 28CA90FF2743BAC3007701FB /* Debug */, + 28CA91002743BAC3007701FB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 28CA91012743BAC3007701FB /* Build configuration list for PBXNativeTarget "LootLogger-Abduaziz_hussun" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 28CA91022743BAC3007701FB /* Debug */, + 28CA91032743BAC3007701FB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 28CA90E52743BAC2007701FB /* Project object */; +} diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/.DS_Store b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/.DS_Store new file mode 100644 index 0000000..0a9b47d Binary files /dev/null and b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/.DS_Store differ diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Controller/DetailViewController.swift b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Controller/DetailViewController.swift new file mode 100644 index 0000000..70b9884 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Controller/DetailViewController.swift @@ -0,0 +1,87 @@ +// +// DetailViewController.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 25/11/2021. +// + +import UIKit +class DetailViewController: UIViewController { + + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + textField.resignFirstResponder() + return true } + + + + @IBOutlet weak var nameField: UITextField! + + @IBOutlet weak var serialNumberField: UITextField! + + + @IBOutlet weak var valueField: UITextField! + + @IBOutlet weak var dateLabel: UILabel! + + + + + + var item: Item! { didSet { + navigationItem.title = item.name +} +} + + let numberFormatter: NumberFormatter = { + let formatter = NumberFormatter() + formatter.numberStyle = .decimal + formatter.minimumFractionDigits = 2 + formatter.maximumFractionDigits = 2 + return formatter + }() + + let dateFormatter: DateFormatter = { + let formatter = DateFormatter() + formatter.dateStyle = .medium + formatter.timeStyle = .none + return formatter + }() + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + nameField.text = item.name + serialNumberField.text = item.serialNumber + valueField.text = numberFormatter.string(from: NSNumber(value: item.valueInDollars)) + dateLabel.text = dateFormatter.string(from: item.dateCreated) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + // "Save" changes to item + item.name = nameField.text ?? "" + item.serialNumber = serialNumberField.text + if let valueText = valueField.text, + let value = numberFormatter.number(from: valueText) { + item.valueInDollars = value.intValue + } else { + item.valueInDollars = 0 + } + } + + + + @IBAction func backgroundTappe(_ sender: UITapGestureRecognizer) { + // Clear first responder + view.endEditing(true) + // "Save" changes to item + item.name = nameField.text ?? "" + item.serialNumber = serialNumberField.text + if let valueText = valueField.text, + let value = numberFormatter.number(from: valueText) { + item.valueInDollars = value.intValue + } else { + item.valueInDollars = 0 + } + } +} diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Controller/ItemsViewController.swift b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Controller/ItemsViewController.swift new file mode 100644 index 0000000..0860d09 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Controller/ItemsViewController.swift @@ -0,0 +1,212 @@ +// +// ItemsViewController.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import UIKit + +class ItemsViewController: UITableViewController { + + var itemStore: ItemStore! + + let myNotificationKey = "com.jonault.LootLogger" + + var uniqueSceneIdentifier: String! + + func sendNotification() + { + let notificationCenter = NotificationCenter.default + notificationCenter.post(name: Notification.Name(rawValue: myNotificationKey), + object: self, + userInfo: ["identifier": uniqueSceneIdentifier!]) + } + + func catchNotification(notification:Notification) -> Void { + guard let sceneIdentifier = notification.userInfo!["identifier"] else { return } + + let senderSceneIdentifier = "\(sceneIdentifier)" + if (senderSceneIdentifier != uniqueSceneIdentifier!) + { + itemStore.loadChanges() + tableView.reloadData() + } + } + + override func tableView(_ tableView: UITableView,//تفعيل الحذف لي Edit + commit editingStyle: UITableViewCell.EditingStyle, + forRowAt indexPath: IndexPath) { + // If the table view is asking to commit a delete command... + if editingStyle == .delete { + let item = itemStore.allItems[indexPath.row] + // Remove the item from the store + itemStore.removeItem(item) + // Also remove that row from the table view with an animation + tableView.deleteRows(at: [indexPath], with: .automatic) + itemStore.saveChanges() + sendNotification() + } + } + @IBAction func toggleEditingMode(_ sender: UIButton) { + // If you are currently in editing mode... + if isEditing { + // Change text of button to inform user of state + sender.setTitle("Edit", for: .normal) + // Turn off editing mode + setEditing(false, animated: true) + } else { + // Change text of button to inform user of state + sender.setTitle("Done", for: .normal) + // Enter editing mode + setEditing(true, animated: true) + } + } + @IBAction func addNewItem(_ sender: UIButton) { + // Create a new item and add it to the store + let newItem = itemStore.createItem() + + if let index = itemStore.allItems.firstIndex(of: newItem) + { + let indexPath = IndexPath(row: index, section: 0) + tableView.insertRows(at: [indexPath], with: .automatic) + } + + itemStore.saveChanges() + sendNotification() + } + override func viewDidLoad() { + super.viewDidLoad() + tableView.rowHeight = UITableView.automaticDimension + tableView.estimatedRowHeight = 65 + let notificationCenter = NotificationCenter.default + notificationCenter.addObserver(forName: NSNotification.Name(rawValue: myNotificationKey), + object: nil, + queue: nil, + using: catchNotification) + // Uncomment the following line to preserve selection between presentations + // self.clearsSelectionOnViewWillAppear = false + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem + }//اظافت قامت خيرات في كل سطر وتستطيع التحكم في مكان الصف وتحريكه الى الاعلا + override func tableView(_ tableView: UITableView, + moveRowAt sourceIndexPath: IndexPath, + // Update the model + to destinationIndexPath: IndexPath) { + itemStore.moveItem(from: sourceIndexPath.row, to: destinationIndexPath.row) + itemStore.saveChanges() + sendNotification() + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // If the triggered segue is the "showItem" segue + switch segue.identifier { + case "showItem": + // Figure out which row was just tapped + if let row = tableView.indexPathForSelectedRow?.row { + // Get the item associated with this row and pass it along + let item = itemStore.allItems[row] + let detailViewController + = segue.destination as! DetailViewController + detailViewController.item = item + } + default: + preconditionFailure("Unexpected segue identifier.") + } + } + + + // MARK: - Table view data source + +// override func numberOfSections(in tableView: UITableView) -> Int { +// // #warning Incomplete implementation, return the number of sections +// return 0 +// } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + tableView.reloadData() + itemStore.saveChanges() + sendNotification() + } + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of rows + return itemStore.allItems.count + } + + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { +// let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath) + + // Get a new or recycled cell + let cell = tableView.dequeueReusableCell(withIdentifier: "ItemCell", + for: indexPath) as! ItemCell + + // Set the text on the cell with the description of the item + // that is at the nth index of items, where n = row this cell + // will appear in on the tableview + let item = itemStore.allItems[indexPath.row] + + // Configure the cell with the Item + cell.nameLabel.text = item.name + cell.serialNumberLabel.text = item.serialNumber + cell.valueLabel.text = "$\(item.valueInDollars)" + + + + + return cell + } + + + } + + + + /* + // Override to support conditional editing of the table view. + override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the specified item to be editable. + return true + } + */ + + /* + // Override to support editing the table view. + override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { + if editingStyle == .delete { + // Delete the row from the data source + tableView.deleteRows(at: [indexPath], with: .fade) + } else if editingStyle == .insert { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } + } + */ + + /* + // Override to support rearranging the table view. + override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) { + + } + */ + + /* + // Override to support conditional rearranging of the table view. + override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the item to be re-orderable. + return true + } + */ + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + + diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Info.plist b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Info.plist new file mode 100644 index 0000000..c9f9d76 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Info.plist @@ -0,0 +1,66 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + Main + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Model/Item.swift b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Model/Item.swift new file mode 100644 index 0000000..d555a15 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Model/Item.swift @@ -0,0 +1,61 @@ +// +// Item.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import Foundation + +class Item: Equatable, Codable { + + + var name: String + var valueInDollars: Int + var serialNumber: String? + var dateCreated: Date + + static func ==(lhs: Item, rhs: Item) -> Bool { + + return lhs.name == rhs.name + && lhs.serialNumber == rhs.serialNumber + && lhs.valueInDollars == rhs.valueInDollars + && lhs.dateCreated == rhs.dateCreated + } + + + init(name: String, + serialNumber: String?, + valueInDollars: Int) { + self.name = name + self.valueInDollars = valueInDollars + self.serialNumber = serialNumber + self.dateCreated = Date() + } + + convenience init(random: Bool = false) { + if random { + let adjectives = ["Fluffy", "Rusty", "Shiny"] + let nouns = ["Bear", "Spork", "Mac"] + + let randomAdjective = adjectives.randomElement()! + let randomNoun = nouns.randomElement()! + + let randomName = "\(randomAdjective) \(randomNoun)" + let randomValue = Int.random(in: 0..<100) + + let randomSerialNumber = + UUID().uuidString.components(separatedBy: "-").first! + + self.init(name: randomName, + serialNumber: randomSerialNumber, + valueInDollars: randomValue) + } else { + self.init(name: "", + serialNumber: nil, + valueInDollars: 0) + } + + } + +} diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Model/ItemCell.swift b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Model/ItemCell.swift new file mode 100644 index 0000000..0734782 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Model/ItemCell.swift @@ -0,0 +1,26 @@ +// +// File.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 17/04/1443 AH. +// + +import UIKit +class ItemCell: UITableViewCell { + + + + + + + + @IBOutlet var nameLabel: UILabel! + + + @IBOutlet var serialNumberLabel: UILabel! + + + @IBOutlet var valueLabel: UILabel! + + +} diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Model/ItemStore.swift b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Model/ItemStore.swift new file mode 100644 index 0000000..228b1c1 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Model/ItemStore.swift @@ -0,0 +1,92 @@ +// +// ItemStore.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import UIKit +//متجر العناصرItemStore +class ItemStore { + var allItems = [Item]() + let itemArchiveURL: URL = { + let documentsDirectories = + FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) + let documentDirectory = documentsDirectories.first! + return documentDirectory.appendingPathComponent("items.plist") + }() + + + init() { + do { + let data = try Data(contentsOf: itemArchiveURL) + let unarchiver = PropertyListDecoder() + let items = try unarchiver.decode([Item].self, from: data) + allItems = items + } catch { + print("Error reading in saved items: \(error)") + } + let notificationCenter = NotificationCenter.default + notificationCenter.addObserver(self,selector: #selector(saveChanges),name:UIScene.didEnterBackgroundNotification,object: nil) + } +// init() { +// for _ in 0..<6 { //عدد العناصر في المصفوفه +// createItem() +// } +// } + //انشاء عنصرcreateItem + @discardableResult func createItem() -> Item { + let newItem = Item(random: true) + //اظافهappend + allItems.append(newItem) + return newItem + } + + @objc func saveChanges() -> Bool { + print("Saving items to: \(itemArchiveURL)") + do { + let encoder = PropertyListEncoder() + let data = try encoder.encode(allItems) + try data.write(to: itemArchiveURL, options: [.atomic]) + print("Saved all of the items") + return true + } catch let encodingError { + print("Error encoding allItems: \(encodingError)") + return false + } + + } + + func removeItem(_ item: Item) { + if let index = allItems.firstIndex(of: item) { + allItems.remove(at: index) + } + } + + func moveItem(from fromIndex: Int, to toIndex: Int) { + if fromIndex == toIndex { + return } + // Get reference to object being moved so you can reinsert it + let movedItem = allItems[fromIndex] + // Remove item from array + allItems.remove(at: fromIndex) + // Insert item in array at new location + allItems.insert(movedItem, at: toIndex) + } + @objc func loadChanges() + { + do + { + let data = try Data(contentsOf: itemArchiveURL) + let unarchiver = PropertyListDecoder() + let items = try unarchiver.decode([Item].self, from: data) + allItems = items + } + catch + { + print("Error reading in saved items: \(error)") + } + } + +} + diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/.DS_Store b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/.DS_Store new file mode 100644 index 0000000..0b089ae Binary files /dev/null and b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/.DS_Store differ diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/AppDelegate.swift b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/AppDelegate.swift new file mode 100644 index 0000000..fc10ec3 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/AppDelegate.swift @@ -0,0 +1,36 @@ +// +// AppDelegate.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/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/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AccentColor.colorset/Contents.json b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AppIcon.appiconset/Contents.json b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/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/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/Contents.json b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/Base.lproj/LaunchScreen.storyboard b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/SceneDelegate.swift b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/SceneDelegate.swift new file mode 100644 index 0000000..245ac15 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/Support/SceneDelegate.swift @@ -0,0 +1,68 @@ +// +// SceneDelegate.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + + + func scene(_ scene: UIScene, + willConnectTo session: UISceneSession, + options connectionOptions: UIScene.ConnectionOptions) { + guard let _ = (scene as? UIWindowScene) else { return } + // Create an ItemStore + + // 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 } + + let itemStore = ItemStore() + + let navController = window!.rootViewController as! UINavigationController + let itemsController = navController.topViewController as! ItemsViewController;itemsController.itemStore = itemStore + //المثد الي تحت تشغل كل صفح في رقم خاص بها وتستطيع التغير من الصفحه الاولى وثنيه بنفس الوقت + let uniqueSceneIdentifier = UUID().uuidString.components(separatedBy: "-").first! + itemsController.uniqueSceneIdentifier = uniqueSceneIdentifier + + } + + 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/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/View/Base.lproj/Main.storyboard b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/View/Base.lproj/Main.storyboard new file mode 100644 index 0000000..e6c25cd --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun Gold/LootLogger-Abduaziz_hussun/View/Base.lproj/Main.storyboard @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.pbxproj b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1c7bf14 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.pbxproj @@ -0,0 +1,394 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 28594ABB274F82A00051EC7F /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28594ABA274F82A00051EC7F /* DetailViewController.swift */; }; + 28646085274B7D9000588B4D /* ItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28646084274B7D9000588B4D /* ItemCell.swift */; }; + 28CA90F12743BAC2007701FB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA90F02743BAC2007701FB /* AppDelegate.swift */; }; + 28CA90F32743BAC2007701FB /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA90F22743BAC2007701FB /* SceneDelegate.swift */; }; + 28CA90F82743BAC2007701FB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28CA90F62743BAC2007701FB /* Main.storyboard */; }; + 28CA90FA2743BAC3007701FB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 28CA90F92743BAC3007701FB /* Assets.xcassets */; }; + 28CA90FD2743BAC3007701FB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28CA90FB2743BAC3007701FB /* LaunchScreen.storyboard */; }; + 28CA91052743BCC0007701FB /* ItemsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA91042743BCC0007701FB /* ItemsViewController.swift */; }; + 28CA91082743BEAA007701FB /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA91072743BEAA007701FB /* Item.swift */; }; + 28CA910B2743CCED007701FB /* ItemStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CA910A2743CCED007701FB /* ItemStore.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 28594ABA274F82A00051EC7F /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = ""; }; + 28646084274B7D9000588B4D /* ItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemCell.swift; sourceTree = ""; }; + 28CA90ED2743BAC2007701FB /* LootLogger-Abduaziz_hussun.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "LootLogger-Abduaziz_hussun.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 28CA90F02743BAC2007701FB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 28CA90F22743BAC2007701FB /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 28CA90F72743BAC2007701FB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 28CA90F92743BAC3007701FB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 28CA90FC2743BAC3007701FB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 28CA90FE2743BAC3007701FB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 28CA91042743BCC0007701FB /* ItemsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemsViewController.swift; sourceTree = ""; }; + 28CA91072743BEAA007701FB /* Item.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Item.swift; sourceTree = ""; }; + 28CA910A2743CCED007701FB /* ItemStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemStore.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 28CA90EA2743BAC2007701FB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 28C968B027467F9C0047103E /* Support */ = { + isa = PBXGroup; + children = ( + 28CA90F02743BAC2007701FB /* AppDelegate.swift */, + 28CA90F22743BAC2007701FB /* SceneDelegate.swift */, + 28CA90FB2743BAC3007701FB /* LaunchScreen.storyboard */, + 28CA90F92743BAC3007701FB /* Assets.xcassets */, + ); + path = Support; + sourceTree = ""; + }; + 28C968B127467FC10047103E /* View */ = { + isa = PBXGroup; + children = ( + 28CA90F62743BAC2007701FB /* Main.storyboard */, + ); + path = View; + sourceTree = ""; + }; + 28CA90E42743BAC2007701FB = { + isa = PBXGroup; + children = ( + 28CA90EF2743BAC2007701FB /* LootLogger-Abduaziz_hussun */, + 28CA90EE2743BAC2007701FB /* Products */, + ); + sourceTree = ""; + }; + 28CA90EE2743BAC2007701FB /* Products */ = { + isa = PBXGroup; + children = ( + 28CA90ED2743BAC2007701FB /* LootLogger-Abduaziz_hussun.app */, + ); + name = Products; + sourceTree = ""; + }; + 28CA90EF2743BAC2007701FB /* LootLogger-Abduaziz_hussun */ = { + isa = PBXGroup; + children = ( + 28CA91092743BEAF007701FB /* Model */, + 28CA91062743BCF0007701FB /* Controller */, + 28C968B127467FC10047103E /* View */, + 28C968B027467F9C0047103E /* Support */, + 28CA90FE2743BAC3007701FB /* Info.plist */, + ); + path = "LootLogger-Abduaziz_hussun"; + sourceTree = ""; + }; + 28CA91062743BCF0007701FB /* Controller */ = { + isa = PBXGroup; + children = ( + 28CA91042743BCC0007701FB /* ItemsViewController.swift */, + 28594ABA274F82A00051EC7F /* DetailViewController.swift */, + ); + path = Controller; + sourceTree = ""; + }; + 28CA91092743BEAF007701FB /* Model */ = { + isa = PBXGroup; + children = ( + 28CA91072743BEAA007701FB /* Item.swift */, + 28646084274B7D9000588B4D /* ItemCell.swift */, + 28CA910A2743CCED007701FB /* ItemStore.swift */, + ); + path = Model; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 28CA90EC2743BAC2007701FB /* LootLogger-Abduaziz_hussun */ = { + isa = PBXNativeTarget; + buildConfigurationList = 28CA91012743BAC3007701FB /* Build configuration list for PBXNativeTarget "LootLogger-Abduaziz_hussun" */; + buildPhases = ( + 28CA90E92743BAC2007701FB /* Sources */, + 28CA90EA2743BAC2007701FB /* Frameworks */, + 28CA90EB2743BAC2007701FB /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "LootLogger-Abduaziz_hussun"; + productName = "LootLogger-Abduaziz_hussun"; + productReference = 28CA90ED2743BAC2007701FB /* LootLogger-Abduaziz_hussun.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 28CA90E52743BAC2007701FB /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1250; + LastUpgradeCheck = 1250; + TargetAttributes = { + 28CA90EC2743BAC2007701FB = { + CreatedOnToolsVersion = 12.5; + }; + }; + }; + buildConfigurationList = 28CA90E82743BAC2007701FB /* Build configuration list for PBXProject "LootLogger-Abduaziz_hussun" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 28CA90E42743BAC2007701FB; + productRefGroup = 28CA90EE2743BAC2007701FB /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 28CA90EC2743BAC2007701FB /* LootLogger-Abduaziz_hussun */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 28CA90EB2743BAC2007701FB /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 28CA90FD2743BAC3007701FB /* LaunchScreen.storyboard in Resources */, + 28CA90FA2743BAC3007701FB /* Assets.xcassets in Resources */, + 28CA90F82743BAC2007701FB /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 28CA90E92743BAC2007701FB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 28CA91082743BEAA007701FB /* Item.swift in Sources */, + 28646085274B7D9000588B4D /* ItemCell.swift in Sources */, + 28CA91052743BCC0007701FB /* ItemsViewController.swift in Sources */, + 28CA90F12743BAC2007701FB /* AppDelegate.swift in Sources */, + 28CA910B2743CCED007701FB /* ItemStore.swift in Sources */, + 28CA90F32743BAC2007701FB /* SceneDelegate.swift in Sources */, + 28594ABB274F82A00051EC7F /* DetailViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 28CA90F62743BAC2007701FB /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 28CA90F72743BAC2007701FB /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 28CA90FB2743BAC3007701FB /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 28CA90FC2743BAC3007701FB /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 28CA90FF2743BAC3007701FB /* 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++14"; + 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 = 14.5; + 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; + }; + 28CA91002743BAC3007701FB /* 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++14"; + 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 = 14.5; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 28CA91022743BAC3007701FB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = X962KR4KLP; + INFOPLIST_FILE = "LootLogger-Abduaziz_hussun/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "azooz.LootLogger-Abduaziz-hussun"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 28CA91032743BAC3007701FB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = X962KR4KLP; + INFOPLIST_FILE = "LootLogger-Abduaziz_hussun/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "azooz.LootLogger-Abduaziz-hussun"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 28CA90E82743BAC2007701FB /* Build configuration list for PBXProject "LootLogger-Abduaziz_hussun" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 28CA90FF2743BAC3007701FB /* Debug */, + 28CA91002743BAC3007701FB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 28CA91012743BAC3007701FB /* Build configuration list for PBXNativeTarget "LootLogger-Abduaziz_hussun" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 28CA91022743BAC3007701FB /* Debug */, + 28CA91032743BAC3007701FB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 28CA90E52743BAC2007701FB /* Project object */; +} diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/.DS_Store b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/.DS_Store new file mode 100644 index 0000000..0a9b47d Binary files /dev/null and b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/.DS_Store differ diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Controller/DetailViewController.swift b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Controller/DetailViewController.swift new file mode 100644 index 0000000..70b9884 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Controller/DetailViewController.swift @@ -0,0 +1,87 @@ +// +// DetailViewController.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 25/11/2021. +// + +import UIKit +class DetailViewController: UIViewController { + + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + textField.resignFirstResponder() + return true } + + + + @IBOutlet weak var nameField: UITextField! + + @IBOutlet weak var serialNumberField: UITextField! + + + @IBOutlet weak var valueField: UITextField! + + @IBOutlet weak var dateLabel: UILabel! + + + + + + var item: Item! { didSet { + navigationItem.title = item.name +} +} + + let numberFormatter: NumberFormatter = { + let formatter = NumberFormatter() + formatter.numberStyle = .decimal + formatter.minimumFractionDigits = 2 + formatter.maximumFractionDigits = 2 + return formatter + }() + + let dateFormatter: DateFormatter = { + let formatter = DateFormatter() + formatter.dateStyle = .medium + formatter.timeStyle = .none + return formatter + }() + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + nameField.text = item.name + serialNumberField.text = item.serialNumber + valueField.text = numberFormatter.string(from: NSNumber(value: item.valueInDollars)) + dateLabel.text = dateFormatter.string(from: item.dateCreated) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + // "Save" changes to item + item.name = nameField.text ?? "" + item.serialNumber = serialNumberField.text + if let valueText = valueField.text, + let value = numberFormatter.number(from: valueText) { + item.valueInDollars = value.intValue + } else { + item.valueInDollars = 0 + } + } + + + + @IBAction func backgroundTappe(_ sender: UITapGestureRecognizer) { + // Clear first responder + view.endEditing(true) + // "Save" changes to item + item.name = nameField.text ?? "" + item.serialNumber = serialNumberField.text + if let valueText = valueField.text, + let value = numberFormatter.number(from: valueText) { + item.valueInDollars = value.intValue + } else { + item.valueInDollars = 0 + } + } +} diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Controller/ItemsViewController.swift b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Controller/ItemsViewController.swift new file mode 100644 index 0000000..f56481d --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Controller/ItemsViewController.swift @@ -0,0 +1,175 @@ +// +// ItemsViewController.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import UIKit + +class ItemsViewController: UITableViewController { + + var itemStore: ItemStore! + override func tableView(_ tableView: UITableView,//تفعيل الحذف لي Edit + commit editingStyle: UITableViewCell.EditingStyle, + forRowAt indexPath: IndexPath) { + // If the table view is asking to commit a delete command... + if editingStyle == .delete { + let item = itemStore.allItems[indexPath.row] + // Remove the item from the store + itemStore.removeItem(item) + // Also remove that row from the table view with an animation + tableView.deleteRows(at: [indexPath], with: .automatic) + } + } + @IBAction func toggleEditingMode(_ sender: UIButton) { + // If you are currently in editing mode... + if isEditing { + // Change text of button to inform user of state + sender.setTitle("Edit", for: .normal) + // Turn off editing mode + setEditing(false, animated: true) + } else { + // Change text of button to inform user of state + sender.setTitle("Done", for: .normal) + // Enter editing mode + setEditing(true, animated: true) + } + } + @IBAction func addNewItem(_ sender: UIButton) { + // Create a new item and add it to the store + let newItem = itemStore.createItem() + + // Figure out where that item is in the array + if let index = itemStore.allItems.firstIndex(of: newItem) { + let indexPath = IndexPath(row: index, section: 0) + // Insert this new row into the table + tableView.insertRows(at: [indexPath], with: .automatic) + } + } + override func viewDidLoad() { + super.viewDidLoad() + tableView.rowHeight = UITableView.automaticDimension + tableView.estimatedRowHeight = 65 + // Uncomment the following line to preserve selection between presentations + // self.clearsSelectionOnViewWillAppear = false + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem + }//اظافت قامت خيرات في كل سطر وتستطيع التحكم في مكان الصف وتحريكه الى الاعلا + override func tableView(_ tableView: UITableView, + moveRowAt sourceIndexPath: IndexPath, + // Update the model + to destinationIndexPath: IndexPath) { + itemStore.moveItem(from: sourceIndexPath.row, to: destinationIndexPath.row) + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // If the triggered segue is the "showItem" segue + switch segue.identifier { + case "showItem": + // Figure out which row was just tapped + if let row = tableView.indexPathForSelectedRow?.row { + // Get the item associated with this row and pass it along + let item = itemStore.allItems[row] + let detailViewController + = segue.destination as! DetailViewController + detailViewController.item = item + } + default: + preconditionFailure("Unexpected segue identifier.") + } + } + + + // MARK: - Table view data source + +// override func numberOfSections(in tableView: UITableView) -> Int { +// // #warning Incomplete implementation, return the number of sections +// return 0 +// } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + tableView.reloadData() + } + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of rows + return itemStore.allItems.count + } + + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { +// let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath) + + // Get a new or recycled cell + let cell = tableView.dequeueReusableCell(withIdentifier: "ItemCell", + for: indexPath) as! ItemCell + + // Set the text on the cell with the description of the item + // that is at the nth index of items, where n = row this cell + // will appear in on the tableview + let item = itemStore.allItems[indexPath.row] + + // Configure the cell with the Item + cell.nameLabel.text = item.name + cell.serialNumberLabel.text = item.serialNumber + cell.valueLabel.text = "$\(item.valueInDollars)" + + + + + return cell + } + + + } + + + + /* + // Override to support conditional editing of the table view. + override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the specified item to be editable. + return true + } + */ + + /* + // Override to support editing the table view. + override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { + if editingStyle == .delete { + // Delete the row from the data source + tableView.deleteRows(at: [indexPath], with: .fade) + } else if editingStyle == .insert { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } + } + */ + + /* + // Override to support rearranging the table view. + override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) { + + } + */ + + /* + // Override to support conditional rearranging of the table view. + override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the item to be re-orderable. + return true + } + */ + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + + diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Info.plist b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Info.plist new file mode 100644 index 0000000..da3eb36 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Info.plist @@ -0,0 +1,66 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + Main + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/Item.swift b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/Item.swift new file mode 100644 index 0000000..d555a15 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/Item.swift @@ -0,0 +1,61 @@ +// +// Item.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import Foundation + +class Item: Equatable, Codable { + + + var name: String + var valueInDollars: Int + var serialNumber: String? + var dateCreated: Date + + static func ==(lhs: Item, rhs: Item) -> Bool { + + return lhs.name == rhs.name + && lhs.serialNumber == rhs.serialNumber + && lhs.valueInDollars == rhs.valueInDollars + && lhs.dateCreated == rhs.dateCreated + } + + + init(name: String, + serialNumber: String?, + valueInDollars: Int) { + self.name = name + self.valueInDollars = valueInDollars + self.serialNumber = serialNumber + self.dateCreated = Date() + } + + convenience init(random: Bool = false) { + if random { + let adjectives = ["Fluffy", "Rusty", "Shiny"] + let nouns = ["Bear", "Spork", "Mac"] + + let randomAdjective = adjectives.randomElement()! + let randomNoun = nouns.randomElement()! + + let randomName = "\(randomAdjective) \(randomNoun)" + let randomValue = Int.random(in: 0..<100) + + let randomSerialNumber = + UUID().uuidString.components(separatedBy: "-").first! + + self.init(name: randomName, + serialNumber: randomSerialNumber, + valueInDollars: randomValue) + } else { + self.init(name: "", + serialNumber: nil, + valueInDollars: 0) + } + + } + +} diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/ItemCell.swift b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/ItemCell.swift new file mode 100644 index 0000000..0734782 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/ItemCell.swift @@ -0,0 +1,26 @@ +// +// File.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 17/04/1443 AH. +// + +import UIKit +class ItemCell: UITableViewCell { + + + + + + + + @IBOutlet var nameLabel: UILabel! + + + @IBOutlet var serialNumberLabel: UILabel! + + + @IBOutlet var valueLabel: UILabel! + + +} diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/ItemStore.swift b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/ItemStore.swift new file mode 100644 index 0000000..fc1fdf4 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Model/ItemStore.swift @@ -0,0 +1,78 @@ +// +// ItemStore.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import UIKit +//متجر العناصرItemStore +class ItemStore { + var allItems = [Item]() + let itemArchiveURL: URL = { + let documentsDirectories = + FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) + let documentDirectory = documentsDirectories.first! + return documentDirectory.appendingPathComponent("items.plist") + }() + + + init() { + do { + let data = try Data(contentsOf: itemArchiveURL) + let unarchiver = PropertyListDecoder() + let items = try unarchiver.decode([Item].self, from: data) + allItems = items + } catch { + print("Error reading in saved items: \(error)") + } + let notificationCenter = NotificationCenter.default + notificationCenter.addObserver(self,selector: #selector(saveChanges),name:UIScene.didEnterBackgroundNotification,object: nil) + } +// init() { +// for _ in 0..<6 { //عدد العناصر في المصفوفه +// createItem() +// } +// } + //انشاء عنصرcreateItem + @discardableResult func createItem() -> Item { + let newItem = Item(random: true) + //اظافهappend + allItems.append(newItem) + return newItem + } + + @objc func saveChanges() -> Bool { + print("Saving items to: \(itemArchiveURL)") + do { + let encoder = PropertyListEncoder() + let data = try encoder.encode(allItems) + try data.write(to: itemArchiveURL, options: [.atomic]) + print("Saved all of the items") + return true + } catch let encodingError { + print("Error encoding allItems: \(encodingError)") + return false + } + + } + + func removeItem(_ item: Item) { + if let index = allItems.firstIndex(of: item) { + allItems.remove(at: index) + } + } + + func moveItem(from fromIndex: Int, to toIndex: Int) { + if fromIndex == toIndex { + return } + // Get reference to object being moved so you can reinsert it + let movedItem = allItems[fromIndex] + // Remove item from array + allItems.remove(at: fromIndex) + // Insert item in array at new location + allItems.insert(movedItem, at: toIndex) + } + +} + diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/.DS_Store b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/.DS_Store new file mode 100644 index 0000000..0b089ae Binary files /dev/null and b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/.DS_Store differ diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/AppDelegate.swift b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/AppDelegate.swift new file mode 100644 index 0000000..fc10ec3 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/AppDelegate.swift @@ -0,0 +1,36 @@ +// +// AppDelegate.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/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/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AccentColor.colorset/Contents.json b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AppIcon.appiconset/Contents.json b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/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/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/Contents.json b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Base.lproj/LaunchScreen.storyboard b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/SceneDelegate.swift b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/SceneDelegate.swift new file mode 100644 index 0000000..8d4acc1 --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/Support/SceneDelegate.swift @@ -0,0 +1,64 @@ +// +// SceneDelegate.swift +// LootLogger-Abduaziz_hussun +// +// Created by azooz alhwiti on 11/04/1443 AH. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + + + func scene(_ scene: UIScene, + willConnectTo session: UISceneSession, + options connectionOptions: UIScene.ConnectionOptions) { + guard let _ = (scene as? UIWindowScene) else { return } + // Create an ItemStore + + // 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 } + + let itemStore = ItemStore() + + let navController = window!.rootViewController as! UINavigationController + let itemsController = navController.topViewController as! ItemsViewController;itemsController.itemStore = itemStore + } + + 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/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/View/Base.lproj/Main.storyboard b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/View/Base.lproj/Main.storyboard new file mode 100644 index 0000000..e6c25cd --- /dev/null +++ b/CH13/LootLogger-Abduaziz_hussun/LootLogger-Abduaziz_hussun/View/Base.lproj/Main.storyboard @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +