From f58a88cb29d48bdc44b44718229bbf12130210a4 Mon Sep 17 00:00:00 2001 From: Sameera Leola Date: Tue, 6 Nov 2018 16:46:20 -0600 Subject: [PATCH 1/7] Added controls to the storyboard and created outlets and actions for all controls --- List/List.xcodeproj/project.pbxproj | 345 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + List/List/AppDelegate.swift | 14 + .../AppIcon.appiconset/Contents.json | 98 +++++ List/List/Assets.xcassets/Contents.json | 6 + List/List/Base.lproj/LaunchScreen.storyboard | 25 ++ List/List/Base.lproj/Main.storyboard | 80 ++++ List/List/Info.plist | 43 +++ List/List/Model.swift | 14 + List/List/ViewController.swift | 19 + 11 files changed, 659 insertions(+) create mode 100644 List/List.xcodeproj/project.pbxproj create mode 100644 List/List.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 List/List.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 List/List/AppDelegate.swift create mode 100644 List/List/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 List/List/Assets.xcassets/Contents.json create mode 100644 List/List/Base.lproj/LaunchScreen.storyboard create mode 100644 List/List/Base.lproj/Main.storyboard create mode 100644 List/List/Info.plist create mode 100644 List/List/Model.swift create mode 100644 List/List/ViewController.swift diff --git a/List/List.xcodeproj/project.pbxproj b/List/List.xcodeproj/project.pbxproj new file mode 100644 index 0000000..d8004c0 --- /dev/null +++ b/List/List.xcodeproj/project.pbxproj @@ -0,0 +1,345 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 37745DDE2192374E002E9B54 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37745DDD2192374E002E9B54 /* AppDelegate.swift */; }; + 37745DE02192374E002E9B54 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37745DDF2192374E002E9B54 /* ViewController.swift */; }; + 37745DE32192374E002E9B54 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 37745DE12192374E002E9B54 /* Main.storyboard */; }; + 37745DE52192374F002E9B54 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 37745DE42192374F002E9B54 /* Assets.xcassets */; }; + 37745DE82192374F002E9B54 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 37745DE62192374F002E9B54 /* LaunchScreen.storyboard */; }; + 37745DF0219240D5002E9B54 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37745DEF219240D5002E9B54 /* Model.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 37745DDA2192374E002E9B54 /* List.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = List.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 37745DDD2192374E002E9B54 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 37745DDF2192374E002E9B54 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 37745DE22192374E002E9B54 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 37745DE42192374F002E9B54 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 37745DE72192374F002E9B54 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 37745DE92192374F002E9B54 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 37745DEF219240D5002E9B54 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 37745DD72192374E002E9B54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 37745DD12192374E002E9B54 = { + isa = PBXGroup; + children = ( + 37745DDC2192374E002E9B54 /* List */, + 37745DDB2192374E002E9B54 /* Products */, + ); + sourceTree = ""; + }; + 37745DDB2192374E002E9B54 /* Products */ = { + isa = PBXGroup; + children = ( + 37745DDA2192374E002E9B54 /* List.app */, + ); + name = Products; + sourceTree = ""; + }; + 37745DDC2192374E002E9B54 /* List */ = { + isa = PBXGroup; + children = ( + 37745DDD2192374E002E9B54 /* AppDelegate.swift */, + 37745DDF2192374E002E9B54 /* ViewController.swift */, + 37745DE12192374E002E9B54 /* Main.storyboard */, + 37745DE42192374F002E9B54 /* Assets.xcassets */, + 37745DEF219240D5002E9B54 /* Model.swift */, + 37745DE62192374F002E9B54 /* LaunchScreen.storyboard */, + 37745DE92192374F002E9B54 /* Info.plist */, + ); + path = List; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 37745DD92192374E002E9B54 /* List */ = { + isa = PBXNativeTarget; + buildConfigurationList = 37745DEC2192374F002E9B54 /* Build configuration list for PBXNativeTarget "List" */; + buildPhases = ( + 37745DD62192374E002E9B54 /* Sources */, + 37745DD72192374E002E9B54 /* Frameworks */, + 37745DD82192374E002E9B54 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = List; + productName = List; + productReference = 37745DDA2192374E002E9B54 /* List.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 37745DD22192374E002E9B54 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1000; + LastUpgradeCheck = 1000; + ORGANIZATIONNAME = "Sameera Leola"; + TargetAttributes = { + 37745DD92192374E002E9B54 = { + CreatedOnToolsVersion = 10.0; + }; + }; + }; + buildConfigurationList = 37745DD52192374E002E9B54 /* Build configuration list for PBXProject "List" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 37745DD12192374E002E9B54; + productRefGroup = 37745DDB2192374E002E9B54 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 37745DD92192374E002E9B54 /* List */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 37745DD82192374E002E9B54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 37745DE82192374F002E9B54 /* LaunchScreen.storyboard in Resources */, + 37745DE52192374F002E9B54 /* Assets.xcassets in Resources */, + 37745DE32192374E002E9B54 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 37745DD62192374E002E9B54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 37745DF0219240D5002E9B54 /* Model.swift in Sources */, + 37745DE02192374E002E9B54 /* ViewController.swift in Sources */, + 37745DDE2192374E002E9B54 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 37745DE12192374E002E9B54 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 37745DE22192374E002E9B54 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 37745DE62192374F002E9B54 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 37745DE72192374F002E9B54 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 37745DEA2192374F002E9B54 /* 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_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; + CODE_SIGN_IDENTITY = "iPhone Developer"; + 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 = 12.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 37745DEB2192374F002E9B54 /* 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_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; + CODE_SIGN_IDENTITY = "iPhone Developer"; + 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 = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 37745DED2192374F002E9B54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = List/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.sameeraleola.List; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 37745DEE2192374F002E9B54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = List/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.sameeraleola.List; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 37745DD52192374E002E9B54 /* Build configuration list for PBXProject "List" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 37745DEA2192374F002E9B54 /* Debug */, + 37745DEB2192374F002E9B54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 37745DEC2192374F002E9B54 /* Build configuration list for PBXNativeTarget "List" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 37745DED2192374F002E9B54 /* Debug */, + 37745DEE2192374F002E9B54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 37745DD22192374E002E9B54 /* Project object */; +} diff --git a/List/List.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/List/List.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1119a07 --- /dev/null +++ b/List/List.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/List/List.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/List/List.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/List/List.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/List/List/AppDelegate.swift b/List/List/AppDelegate.swift new file mode 100644 index 0000000..3c03cdc --- /dev/null +++ b/List/List/AppDelegate.swift @@ -0,0 +1,14 @@ + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + +} diff --git a/List/List/Assets.xcassets/AppIcon.appiconset/Contents.json b/List/List/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/List/List/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/List/List/Assets.xcassets/Contents.json b/List/List/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/List/List/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/List/List/Base.lproj/LaunchScreen.storyboard b/List/List/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..bfa3612 --- /dev/null +++ b/List/List/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/List/List/Base.lproj/Main.storyboard b/List/List/Base.lproj/Main.storyboard new file mode 100644 index 0000000..1bda736 --- /dev/null +++ b/List/List/Base.lproj/Main.storyboard @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/List/List/Info.plist b/List/List/Info.plist new file mode 100644 index 0000000..89d7858 --- /dev/null +++ b/List/List/Info.plist @@ -0,0 +1,43 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/List/List/Model.swift b/List/List/Model.swift new file mode 100644 index 0000000..1b1e202 --- /dev/null +++ b/List/List/Model.swift @@ -0,0 +1,14 @@ +class Model { + static let shared = Model() + private init() {} + + private(set) var items: [String] = [] + + func add(_ item: String) { + // add the item to your items list + } + + func resetItems() { + // reset your items list here + } +} diff --git a/List/List/ViewController.swift b/List/List/ViewController.swift new file mode 100644 index 0000000..276d9f5 --- /dev/null +++ b/List/List/ViewController.swift @@ -0,0 +1,19 @@ +import UIKit + +class ViewController: UIViewController { + + @IBOutlet weak var textField: UITextField! + + @IBOutlet weak var label: UILabel! + + @IBAction func shouldAdd(_ sender: Any) { + let text = textField.text ?? "" + if (!text.isEmpty) { + + } + } + + + @IBAction func shouldReset(_ sender: Any) { + } +} From 32aa6382614defc806eba1bda885b1318b1b5733 Mon Sep 17 00:00:00 2001 From: Sameera Leola Date: Tue, 6 Nov 2018 18:04:04 -0600 Subject: [PATCH 2/7] Added add function and resetItems function to the model --- List/List/Base.lproj/Main.storyboard | 12 ++++-------- List/List/Model.swift | 3 +++ List/List/ViewController.swift | 8 +++++++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/List/List/Base.lproj/Main.storyboard b/List/List/Base.lproj/Main.storyboard index 1bda736..902baa5 100644 --- a/List/List/Base.lproj/Main.storyboard +++ b/List/List/Base.lproj/Main.storyboard @@ -33,8 +33,7 @@ - - + @@ -49,8 +48,7 @@ - - + @@ -66,10 +64,8 @@ - - - - + + diff --git a/List/List/Model.swift b/List/List/Model.swift index 1b1e202..96c3291 100644 --- a/List/List/Model.swift +++ b/List/List/Model.swift @@ -6,9 +6,12 @@ class Model { func add(_ item: String) { // add the item to your items list + items.append(item) + print(items) } func resetItems() { // reset your items list here + items = [] } } diff --git a/List/List/ViewController.swift b/List/List/ViewController.swift index 276d9f5..f47c6d0 100644 --- a/List/List/ViewController.swift +++ b/List/List/ViewController.swift @@ -9,11 +9,17 @@ class ViewController: UIViewController { @IBAction func shouldAdd(_ sender: Any) { let text = textField.text ?? "" if (!text.isEmpty) { - + Model.shared.add(text) + let joined = Model.shared.items.joined(separator: "\n") + print(joined) + label.text = joined + textField.text = "" } } @IBAction func shouldReset(_ sender: Any) { + Model.shared.resetItems() + label.text = "" } } From 6ac92729e40b59f5e6f4ff0114f9688f8fa94c6f Mon Sep 17 00:00:00 2001 From: Sameera Leola Date: Tue, 6 Nov 2018 18:16:19 -0600 Subject: [PATCH 3/7] Added bullets to each item in the list --- List/List/Model.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/List/List/Model.swift b/List/List/Model.swift index 96c3291..6dc4660 100644 --- a/List/List/Model.swift +++ b/List/List/Model.swift @@ -6,7 +6,8 @@ class Model { func add(_ item: String) { // add the item to your items list - items.append(item) + let bulletPoint: String = "\u{2022}" + items.append(bulletPoint + " " + item) print(items) } From b97ad03cf54ce638617b129eb6fb8004c2d87fdd Mon Sep 17 00:00:00 2001 From: Sameera Leola Date: Tue, 6 Nov 2018 18:37:31 -0600 Subject: [PATCH 4/7] Added Questions.txt file which contains answers to challenge questions --- List/List/Model.swift | 5 ++++- Questions.txt | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 Questions.txt diff --git a/List/List/Model.swift b/List/List/Model.swift index 6dc4660..ab9c536 100644 --- a/List/List/Model.swift +++ b/List/List/Model.swift @@ -8,11 +8,14 @@ class Model { // add the item to your items list let bulletPoint: String = "\u{2022}" items.append(bulletPoint + " " + item) - print(items) } func resetItems() { // reset your items list here items = [] } + + func printItems() { + // print items to the debug console + } } diff --git a/Questions.txt b/Questions.txt new file mode 100644 index 0000000..866415a --- /dev/null +++ b/Questions.txt @@ -0,0 +1,18 @@ +View Controllers and the Model-View-Controller Question + +What is Interface Builder's object library? +The Interface Builder’s object library is a workspace window in Xcode. This workspace window lists the objects that can be used to create a user interface on s storyboard. + +What is the difference between an outlet and an action? +An outlet is a reference to an object that has been placed onto a storyboard scene. Adding the outlet to the storyboard source code provides programatic access and manipulation of the object. + +An action allows insertion of code that is sourced in items in Interface Builder( detects and manipulates behaviors) + +What is the role of a View Controller? +What is a Controller = conduit between views and models + +What is Model-View-Controller? +Model-View-Controller is an architectural design patterns. + +Why use Model-View-Controller? +MVC structures our code in a way that promotes easy scalability and reusability. \ No newline at end of file From 3238673a070725f895d3891ba54d0ca5c29bb9b3 Mon Sep 17 00:00:00 2001 From: Sameera Leola Date: Tue, 6 Nov 2018 18:57:44 -0600 Subject: [PATCH 5/7] Replace the text field label with a non-editable text view so list can be top-aligned --- List/List/Base.lproj/Main.storyboard | 12 ++++++------ List/List/ViewController.swift | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/List/List/Base.lproj/Main.storyboard b/List/List/Base.lproj/Main.storyboard index 902baa5..cf49c5e 100644 --- a/List/List/Base.lproj/Main.storyboard +++ b/List/List/Base.lproj/Main.storyboard @@ -38,12 +38,12 @@ - + + + + + diff --git a/List/List/ViewController.swift b/List/List/ViewController.swift index 697d6df..69c1663 100644 --- a/List/List/ViewController.swift +++ b/List/List/ViewController.swift @@ -18,9 +18,13 @@ class ViewController: UIViewController { } } - @IBAction func shouldReset(_ sender: Any) { Model.shared.resetItems() textView.text = "" } + + @IBAction func printList(_ sender: Any) { + print(Model.shared.items.joined(separator: "\n")) + } + }