From 972bdfec1dfbfb7620290071f1775e3a51025ca9 Mon Sep 17 00:00:00 2001 From: Vijay Das Date: Tue, 6 Nov 2018 15:18:23 -0600 Subject: [PATCH 1/6] added txt file for responses to questions --- Vijay-Day2Module-Questions.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Vijay-Day2Module-Questions.txt diff --git a/Vijay-Day2Module-Questions.txt b/Vijay-Day2Module-Questions.txt new file mode 100644 index 0000000..cf29663 --- /dev/null +++ b/Vijay-Day2Module-Questions.txt @@ -0,0 +1,17 @@ +Vijay-Day2Module-Questions.txt + +Question and response: +1. What is Interface Builder's object library? +The object library is a collection of pre-built interface objects used to create the user interface. These objects come with methods as well to manage them. + +2. What is the difference between an outlet and an action? +An OUTLET gives the developer a local variable that references an interface element to access that elements methods. + +3. What is the role of a View Controller? +The job of the View Controller is to manage interface objects (that can also be considered sub-views) and also to coordinate interaction from the user interface to data model as well as other controllers. + +4. What is Model-View-Controller? +Model-View-Controller is a design pattern used in software development. The pattern calls for separating the user interface (the View) from the data being manipulated (the Model) and using an intermediary called the Controlller to manage this interaction between the View and the Model. + +5. Why use Model-View-Controller? +Developers use this deaign pattern for all the same reasons they employ any pattern. That is to produce reusable, strong, and resilient code. These qualities arise because the behavior or state is separated from the presentation. From 8fa9e58e50832b510b1d8601de4cf33307d3beb4 Mon Sep 17 00:00:00 2001 From: Vijay Das Date: Tue, 6 Nov 2018 15:42:37 -0600 Subject: [PATCH 2/6] Project setup with Model class --- List/List.xcodeproj/project.pbxproj | 345 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + List/List/AppDelegate.swift | 10 + .../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 | 24 ++ List/List/Info.plist | 45 +++ List/List/Model.swift | 10 + List/List/ViewController.swift | 6 + 11 files changed, 584 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..538fd1e --- /dev/null +++ b/List/List.xcodeproj/project.pbxproj @@ -0,0 +1,345 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 27A354B921923ED200D55C02 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27A354B821923ED200D55C02 /* AppDelegate.swift */; }; + 27A354BB21923ED200D55C02 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27A354BA21923ED200D55C02 /* ViewController.swift */; }; + 27A354BE21923ED200D55C02 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 27A354BC21923ED200D55C02 /* Main.storyboard */; }; + 27A354C021923ED500D55C02 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 27A354BF21923ED500D55C02 /* Assets.xcassets */; }; + 27A354C321923ED500D55C02 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 27A354C121923ED500D55C02 /* LaunchScreen.storyboard */; }; + 27A354CB219240C300D55C02 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27A354CA219240C300D55C02 /* Model.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 27A354B521923ED200D55C02 /* List.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = List.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 27A354B821923ED200D55C02 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 27A354BA21923ED200D55C02 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 27A354BD21923ED200D55C02 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 27A354BF21923ED500D55C02 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 27A354C221923ED500D55C02 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 27A354C421923ED500D55C02 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 27A354CA219240C300D55C02 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 27A354B221923ED200D55C02 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 27A354AC21923ED200D55C02 = { + isa = PBXGroup; + children = ( + 27A354B721923ED200D55C02 /* List */, + 27A354B621923ED200D55C02 /* Products */, + ); + sourceTree = ""; + }; + 27A354B621923ED200D55C02 /* Products */ = { + isa = PBXGroup; + children = ( + 27A354B521923ED200D55C02 /* List.app */, + ); + name = Products; + sourceTree = ""; + }; + 27A354B721923ED200D55C02 /* List */ = { + isa = PBXGroup; + children = ( + 27A354B821923ED200D55C02 /* AppDelegate.swift */, + 27A354BA21923ED200D55C02 /* ViewController.swift */, + 27A354CA219240C300D55C02 /* Model.swift */, + 27A354BC21923ED200D55C02 /* Main.storyboard */, + 27A354BF21923ED500D55C02 /* Assets.xcassets */, + 27A354C121923ED500D55C02 /* LaunchScreen.storyboard */, + 27A354C421923ED500D55C02 /* Info.plist */, + ); + path = List; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 27A354B421923ED200D55C02 /* List */ = { + isa = PBXNativeTarget; + buildConfigurationList = 27A354C721923ED500D55C02 /* Build configuration list for PBXNativeTarget "List" */; + buildPhases = ( + 27A354B121923ED200D55C02 /* Sources */, + 27A354B221923ED200D55C02 /* Frameworks */, + 27A354B321923ED200D55C02 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = List; + productName = List; + productReference = 27A354B521923ED200D55C02 /* List.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 27A354AD21923ED200D55C02 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1010; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = "Vijay Das"; + TargetAttributes = { + 27A354B421923ED200D55C02 = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = 27A354B021923ED200D55C02 /* Build configuration list for PBXProject "List" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 27A354AC21923ED200D55C02; + productRefGroup = 27A354B621923ED200D55C02 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 27A354B421923ED200D55C02 /* List */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 27A354B321923ED200D55C02 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 27A354C321923ED500D55C02 /* LaunchScreen.storyboard in Resources */, + 27A354C021923ED500D55C02 /* Assets.xcassets in Resources */, + 27A354BE21923ED200D55C02 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 27A354B121923ED200D55C02 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 27A354CB219240C300D55C02 /* Model.swift in Sources */, + 27A354BB21923ED200D55C02 /* ViewController.swift in Sources */, + 27A354B921923ED200D55C02 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 27A354BC21923ED200D55C02 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 27A354BD21923ED200D55C02 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 27A354C121923ED500D55C02 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 27A354C221923ED500D55C02 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 27A354C521923ED500D55C02 /* 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.1; + 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; + }; + 27A354C621923ED500D55C02 /* 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.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 27A354C821923ED500D55C02 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = F29U3VL727; + INFOPLIST_FILE = List/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = vijaydas.List; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 27A354C921923ED500D55C02 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = F29U3VL727; + INFOPLIST_FILE = List/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = vijaydas.List; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 27A354B021923ED200D55C02 /* Build configuration list for PBXProject "List" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 27A354C521923ED500D55C02 /* Debug */, + 27A354C621923ED500D55C02 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 27A354C721923ED500D55C02 /* Build configuration list for PBXNativeTarget "List" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 27A354C821923ED500D55C02 /* Debug */, + 27A354C921923ED500D55C02 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 27A354AD21923ED200D55C02 /* 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..31619e2 --- /dev/null +++ b/List/List/AppDelegate.swift @@ -0,0 +1,10 @@ +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + var window: UIWindow? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + 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..f1bcf38 --- /dev/null +++ b/List/List/Base.lproj/Main.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/List/List/Info.plist b/List/List/Info.plist new file mode 100644 index 0000000..16be3b6 --- /dev/null +++ b/List/List/Info.plist @@ -0,0 +1,45 @@ + + + + + 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 + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/List/List/Model.swift b/List/List/Model.swift new file mode 100644 index 0000000..c577f10 --- /dev/null +++ b/List/List/Model.swift @@ -0,0 +1,10 @@ +import Foundation +import UIKit + +class Model { + static let shared = Model() + private init() {} + + private(set) var items: [String] = [] +} + diff --git a/List/List/ViewController.swift b/List/List/ViewController.swift new file mode 100644 index 0000000..07b5665 --- /dev/null +++ b/List/List/ViewController.swift @@ -0,0 +1,6 @@ +import UIKit + +class ViewController: UIViewController { + +} + From c9fb6b8781ca06e0c6f38bac29c2213d9c6f718f Mon Sep 17 00:00:00 2001 From: Vijay Das Date: Tue, 6 Nov 2018 16:53:54 -0600 Subject: [PATCH 3/6] Created model and interface --- List/List/Base.lproj/Main.storyboard | 49 ++++++++++++++++++++++++++-- List/List/Model.swift | 8 +++++ List/List/ViewController.swift | 2 ++ 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/List/List/Base.lproj/Main.storyboard b/List/List/Base.lproj/Main.storyboard index f1bcf38..8077161 100644 --- a/List/List/Base.lproj/Main.storyboard +++ b/List/List/Base.lproj/Main.storyboard @@ -1,7 +1,11 @@ - + + + + - + + @@ -9,16 +13,55 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/List/List/Model.swift b/List/List/Model.swift index c577f10..25061f0 100644 --- a/List/List/Model.swift +++ b/List/List/Model.swift @@ -6,5 +6,13 @@ class Model { private init() {} private(set) var items: [String] = [] + + func add(_ item: String) { + items.append(item) + } + + func resetItems() { + items = [] } +} diff --git a/List/List/ViewController.swift b/List/List/ViewController.swift index 07b5665..261bd93 100644 --- a/List/List/ViewController.swift +++ b/List/List/ViewController.swift @@ -2,5 +2,7 @@ import UIKit class ViewController: UIViewController { + + } From 29d8c82c6a2320264a919789ed18b9a04a3fa81f Mon Sep 17 00:00:00 2001 From: Vijay Das Date: Tue, 6 Nov 2018 17:49:57 -0600 Subject: [PATCH 4/6] MVP completed --- List/List/Base.lproj/Main.storyboard | 18 ++++++++++++++---- List/List/Model.swift | 2 +- List/List/ViewController.swift | 17 ++++++++++++++++- model.playground/Contents.swift | 23 +++++++++++++++++++++++ model.playground/contents.xcplayground | 4 ++++ 5 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 model.playground/Contents.swift create mode 100644 model.playground/contents.xcplayground diff --git a/List/List/Base.lproj/Main.storyboard b/List/List/Base.lproj/Main.storyboard index 8077161..576b534 100644 --- a/List/List/Base.lproj/Main.storyboard +++ b/List/List/Base.lproj/Main.storyboard @@ -19,7 +19,7 @@ - + @@ -33,18 +33,24 @@ @@ -54,10 +60,14 @@ - + + + + + diff --git a/List/List/Model.swift b/List/List/Model.swift index 25061f0..a044ff4 100644 --- a/List/List/Model.swift +++ b/List/List/Model.swift @@ -12,7 +12,7 @@ class Model { } func resetItems() { - items = [] + items.removeAll() } } diff --git a/List/List/ViewController.swift b/List/List/ViewController.swift index 261bd93..e48a184 100644 --- a/List/List/ViewController.swift +++ b/List/List/ViewController.swift @@ -1,8 +1,23 @@ import UIKit class ViewController: UIViewController { - + @IBOutlet weak var textField: UITextField! + @IBOutlet weak var label: UILabel! + @IBAction func shouldAdd(_ sender: UITextField) { + let text = textField.text ?? "" + if !text.isEmpty { + Model.shared.add(text) + textField.text = "" + } + let joined = Model.shared.items.joined(separator: "\n") + label.text = joined + } + + @IBAction func shouldReset(_ sender: UIButton) { + Model.shared.resetItems() + label.text = "" + } } diff --git a/model.playground/Contents.swift b/model.playground/Contents.swift new file mode 100644 index 0000000..2d66f7f --- /dev/null +++ b/model.playground/Contents.swift @@ -0,0 +1,23 @@ +import UIKit + +class Model { + static let shared = Model() + private init() {} + + private(set) var items: [String] = [] + + func add(_ item: String) { + items.append(item) + } + + func resetItems() { + items = [] + } + +} + +print(Model.shared.items) + +Model.shared.add("Yo") + +print(Model.shared.items) diff --git a/model.playground/contents.xcplayground b/model.playground/contents.xcplayground new file mode 100644 index 0000000..9f5f2f4 --- /dev/null +++ b/model.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file From 0ff45794397549c69946afbd9fa9293431ffa087 Mon Sep 17 00:00:00 2001 From: Vijay Das Date: Tue, 6 Nov 2018 18:20:32 -0600 Subject: [PATCH 5/6] version with first two stretch goals --- List/List/Base.lproj/Main.storyboard | 15 +++++++++++---- List/List/ViewController.swift | 5 ++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/List/List/Base.lproj/Main.storyboard b/List/List/Base.lproj/Main.storyboard index 576b534..7e67c14 100644 --- a/List/List/Base.lproj/Main.storyboard +++ b/List/List/Base.lproj/Main.storyboard @@ -19,7 +19,7 @@ - + @@ -40,25 +40,32 @@ + - + diff --git a/List/List/ViewController.swift b/List/List/ViewController.swift index e48a184..f3ee390 100644 --- a/List/List/ViewController.swift +++ b/List/List/ViewController.swift @@ -8,7 +8,7 @@ class ViewController: UIViewController { @IBAction func shouldAdd(_ sender: UITextField) { let text = textField.text ?? "" if !text.isEmpty { - Model.shared.add(text) + Model.shared.add("* \(text)") textField.text = "" } let joined = Model.shared.items.joined(separator: "\n") @@ -19,5 +19,8 @@ class ViewController: UIViewController { Model.shared.resetItems() label.text = "" } + @IBAction func print(_ sender: UIButton) { + Swift.print(Model.shared.items) + } } From a9a091d25dc816d6b44a6c43d0875e403801e8ca Mon Sep 17 00:00:00 2001 From: Vijay Das Date: Tue, 6 Nov 2018 19:00:42 -0600 Subject: [PATCH 6/6] version with third stretch --- 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 7e67c14..b8ee762 100644 --- a/List/List/Base.lproj/Main.storyboard +++ b/List/List/Base.lproj/Main.storyboard @@ -39,12 +39,12 @@ - + + + +