diff --git a/Chapter1/BareBasic/BareBasic.xcodeproj/project.pbxproj b/Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic.xcodeproj/project.pbxproj similarity index 100% rename from Chapter1/BareBasic/BareBasic.xcodeproj/project.pbxproj rename to Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic.xcodeproj/project.pbxproj diff --git a/Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Chapter1/BareBasic/BareBasic/AppDelegate.swift b/Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic/AppDelegate.swift similarity index 100% rename from Chapter1/BareBasic/BareBasic/AppDelegate.swift rename to Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic/AppDelegate.swift diff --git a/Chapter1/BareBasic/BareBasic/Assets.xcassets/AppIcon.appiconset/Contents.json b/Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Chapter1/BareBasic/BareBasic/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Chapter1/BareBasic/BareBasic/Base.lproj/LaunchScreen.storyboard b/Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from Chapter1/BareBasic/BareBasic/Base.lproj/LaunchScreen.storyboard rename to Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic/Base.lproj/LaunchScreen.storyboard diff --git a/Chapter1/BareBasic/BareBasic/Base.lproj/Main.storyboard b/Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic/Base.lproj/Main.storyboard similarity index 100% rename from Chapter1/BareBasic/BareBasic/Base.lproj/Main.storyboard rename to Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic/Base.lproj/Main.storyboard diff --git a/Chapter1/BareBasic/BareBasic/Info.plist b/Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic/Info.plist similarity index 100% rename from Chapter1/BareBasic/BareBasic/Info.plist rename to Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic/Info.plist diff --git a/Chapter1/BareBasic/BareBasic/ViewController.swift b/Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic/ViewController.swift similarity index 100% rename from Chapter1/BareBasic/BareBasic/ViewController.swift rename to Chapter1/Project Files/Swift 2(old)/BareBasic/BareBasic/ViewController.swift diff --git a/Chapter1/HelloiPhone/HelloiPhone.xcodeproj/project.pbxproj b/Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone.xcodeproj/project.pbxproj similarity index 100% rename from Chapter1/HelloiPhone/HelloiPhone.xcodeproj/project.pbxproj rename to Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone.xcodeproj/project.pbxproj diff --git a/Chapter1/HelloiPhone/HelloiPhone/AppDelegate.swift b/Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone/AppDelegate.swift similarity index 100% rename from Chapter1/HelloiPhone/HelloiPhone/AppDelegate.swift rename to Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone/AppDelegate.swift diff --git a/Chapter1/HelloiPhone/HelloiPhone/Assets.xcassets/AppIcon.appiconset/Contents.json b/Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Chapter1/HelloiPhone/HelloiPhone/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Chapter1/HelloiPhone/HelloiPhone/Base.lproj/LaunchScreen.storyboard b/Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from Chapter1/HelloiPhone/HelloiPhone/Base.lproj/LaunchScreen.storyboard rename to Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone/Base.lproj/LaunchScreen.storyboard diff --git a/Chapter1/HelloiPhone/HelloiPhone/Base.lproj/Main.storyboard b/Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone/Base.lproj/Main.storyboard similarity index 100% rename from Chapter1/HelloiPhone/HelloiPhone/Base.lproj/Main.storyboard rename to Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone/Base.lproj/Main.storyboard diff --git a/Chapter1/HelloiPhone/HelloiPhone/Info.plist b/Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone/Info.plist similarity index 100% rename from Chapter1/HelloiPhone/HelloiPhone/Info.plist rename to Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone/Info.plist diff --git a/Chapter1/HelloiPhone/HelloiPhone/ViewController.swift b/Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone/ViewController.swift similarity index 100% rename from Chapter1/HelloiPhone/HelloiPhone/ViewController.swift rename to Chapter1/Project Files/Swift 2(old)/HelloiPhone/HelloiPhone/ViewController.swift diff --git a/Chapter1/Project Files/Swift 4/BareBasic/BareBasic.xcodeproj/project.pbxproj b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1d98f92 --- /dev/null +++ b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic.xcodeproj/project.pbxproj @@ -0,0 +1,327 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXBuildFile section */ + 9FA414651FAE09E400A54F89 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA414641FAE09E400A54F89 /* AppDelegate.swift */; }; + 9FA414671FAE09E400A54F89 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA414661FAE09E400A54F89 /* ViewController.swift */; }; + 9FA4146A1FAE09E400A54F89 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FA414681FAE09E400A54F89 /* Main.storyboard */; }; + 9FA4146C1FAE09E400A54F89 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9FA4146B1FAE09E400A54F89 /* Assets.xcassets */; }; + 9FA4146F1FAE09E400A54F89 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FA4146D1FAE09E400A54F89 /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 9FA414611FAE09E400A54F89 /* BareBasic.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BareBasic.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 9FA414641FAE09E400A54F89 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 9FA414661FAE09E400A54F89 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 9FA414691FAE09E400A54F89 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 9FA4146B1FAE09E400A54F89 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 9FA4146E1FAE09E400A54F89 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 9FA414701FAE09E400A54F89 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9FA4145E1FAE09E400A54F89 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9FA414581FAE09E400A54F89 = { + isa = PBXGroup; + children = ( + 9FA414631FAE09E400A54F89 /* BareBasic */, + 9FA414621FAE09E400A54F89 /* Products */, + ); + sourceTree = ""; + }; + 9FA414621FAE09E400A54F89 /* Products */ = { + isa = PBXGroup; + children = ( + 9FA414611FAE09E400A54F89 /* BareBasic.app */, + ); + name = Products; + sourceTree = ""; + }; + 9FA414631FAE09E400A54F89 /* BareBasic */ = { + isa = PBXGroup; + children = ( + 9FA414641FAE09E400A54F89 /* AppDelegate.swift */, + 9FA414661FAE09E400A54F89 /* ViewController.swift */, + 9FA414681FAE09E400A54F89 /* Main.storyboard */, + 9FA4146B1FAE09E400A54F89 /* Assets.xcassets */, + 9FA4146D1FAE09E400A54F89 /* LaunchScreen.storyboard */, + 9FA414701FAE09E400A54F89 /* Info.plist */, + ); + path = BareBasic; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 9FA414601FAE09E400A54F89 /* BareBasic */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9FA414731FAE09E400A54F89 /* Build configuration list for PBXNativeTarget "BareBasic" */; + buildPhases = ( + 9FA4145D1FAE09E400A54F89 /* Sources */, + 9FA4145E1FAE09E400A54F89 /* Frameworks */, + 9FA4145F1FAE09E400A54F89 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = BareBasic; + productName = BareBasic; + productReference = 9FA414611FAE09E400A54F89 /* BareBasic.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9FA414591FAE09E400A54F89 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0900; + LastUpgradeCheck = 0900; + ORGANIZATIONNAME = "Hakyung Noah"; + TargetAttributes = { + 9FA414601FAE09E400A54F89 = { + CreatedOnToolsVersion = 9.0; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 9FA4145C1FAE09E400A54F89 /* Build configuration list for PBXProject "BareBasic" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 9FA414581FAE09E400A54F89; + productRefGroup = 9FA414621FAE09E400A54F89 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 9FA414601FAE09E400A54F89 /* BareBasic */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 9FA4145F1FAE09E400A54F89 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9FA4146F1FAE09E400A54F89 /* LaunchScreen.storyboard in Resources */, + 9FA4146C1FAE09E400A54F89 /* Assets.xcassets in Resources */, + 9FA4146A1FAE09E400A54F89 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 9FA4145D1FAE09E400A54F89 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9FA414671FAE09E400A54F89 /* ViewController.swift in Sources */, + 9FA414651FAE09E400A54F89 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 9FA414681FAE09E400A54F89 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9FA414691FAE09E400A54F89 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 9FA4146D1FAE09E400A54F89 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9FA4146E1FAE09E400A54F89 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 9FA414711FAE09E400A54F89 /* 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_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_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 = 11.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 9FA414721FAE09E400A54F89 /* 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_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_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 = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 9FA414741FAE09E400A54F89 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = TZCQN9XXN6; + INFOPLIST_FILE = BareBasic/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.InterfaceProgramming2.www.BareBasic; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 9FA414751FAE09E400A54F89 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = TZCQN9XXN6; + INFOPLIST_FILE = BareBasic/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.InterfaceProgramming2.www.BareBasic; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 9FA4145C1FAE09E400A54F89 /* Build configuration list for PBXProject "BareBasic" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9FA414711FAE09E400A54F89 /* Debug */, + 9FA414721FAE09E400A54F89 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9FA414731FAE09E400A54F89 /* Build configuration list for PBXNativeTarget "BareBasic" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9FA414741FAE09E400A54F89 /* Debug */, + 9FA414751FAE09E400A54F89 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9FA414591FAE09E400A54F89 /* Project object */; +} diff --git a/Chapter1/Project Files/Swift 4/BareBasic/BareBasic.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..a2f94f8 --- /dev/null +++ b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/AppDelegate.swift b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/AppDelegate.swift new file mode 100644 index 0000000..c920607 --- /dev/null +++ b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// BareBasic +// +// Created by Hakyung Noa on 04/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/Assets.xcassets/AppIcon.appiconset/Contents.json b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/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/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/Base.lproj/LaunchScreen.storyboard b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f83f6fd --- /dev/null +++ b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/Base.lproj/Main.storyboard b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/Base.lproj/Main.storyboard new file mode 100644 index 0000000..0f22c71 --- /dev/null +++ b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/Base.lproj/Main.storyboard @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/Info.plist b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/Info.plist new file mode 100644 index 0000000..16be3b6 --- /dev/null +++ b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/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/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/ViewController.swift b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/ViewController.swift new file mode 100644 index 0000000..b439064 --- /dev/null +++ b/Chapter1/Project Files/Swift 4/BareBasic/BareBasic/ViewController.swift @@ -0,0 +1,25 @@ +// +// ViewController.swift +// BareBasic +// +// Created by Hakyung Noa on 04/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + +} + diff --git a/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone.xcodeproj/project.pbxproj b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone.xcodeproj/project.pbxproj new file mode 100644 index 0000000..2786da2 --- /dev/null +++ b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone.xcodeproj/project.pbxproj @@ -0,0 +1,327 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXBuildFile section */ + 9F9ABFE51FAE0ED40021156B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F9ABFE41FAE0ED40021156B /* AppDelegate.swift */; }; + 9F9ABFE71FAE0ED40021156B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F9ABFE61FAE0ED40021156B /* ViewController.swift */; }; + 9F9ABFEA1FAE0ED40021156B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F9ABFE81FAE0ED40021156B /* Main.storyboard */; }; + 9F9ABFEC1FAE0ED40021156B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F9ABFEB1FAE0ED40021156B /* Assets.xcassets */; }; + 9F9ABFEF1FAE0ED40021156B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F9ABFED1FAE0ED40021156B /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 9F9ABFE11FAE0ED40021156B /* HelloiPhone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloiPhone.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 9F9ABFE41FAE0ED40021156B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 9F9ABFE61FAE0ED40021156B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 9F9ABFE91FAE0ED40021156B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 9F9ABFEB1FAE0ED40021156B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 9F9ABFEE1FAE0ED40021156B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 9F9ABFF01FAE0ED40021156B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9F9ABFDE1FAE0ED40021156B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9F9ABFD81FAE0ED40021156B = { + isa = PBXGroup; + children = ( + 9F9ABFE31FAE0ED40021156B /* HelloiPhone */, + 9F9ABFE21FAE0ED40021156B /* Products */, + ); + sourceTree = ""; + }; + 9F9ABFE21FAE0ED40021156B /* Products */ = { + isa = PBXGroup; + children = ( + 9F9ABFE11FAE0ED40021156B /* HelloiPhone.app */, + ); + name = Products; + sourceTree = ""; + }; + 9F9ABFE31FAE0ED40021156B /* HelloiPhone */ = { + isa = PBXGroup; + children = ( + 9F9ABFE41FAE0ED40021156B /* AppDelegate.swift */, + 9F9ABFE61FAE0ED40021156B /* ViewController.swift */, + 9F9ABFE81FAE0ED40021156B /* Main.storyboard */, + 9F9ABFEB1FAE0ED40021156B /* Assets.xcassets */, + 9F9ABFED1FAE0ED40021156B /* LaunchScreen.storyboard */, + 9F9ABFF01FAE0ED40021156B /* Info.plist */, + ); + path = HelloiPhone; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 9F9ABFE01FAE0ED40021156B /* HelloiPhone */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9F9ABFF31FAE0ED40021156B /* Build configuration list for PBXNativeTarget "HelloiPhone" */; + buildPhases = ( + 9F9ABFDD1FAE0ED40021156B /* Sources */, + 9F9ABFDE1FAE0ED40021156B /* Frameworks */, + 9F9ABFDF1FAE0ED40021156B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = HelloiPhone; + productName = HelloiPhone; + productReference = 9F9ABFE11FAE0ED40021156B /* HelloiPhone.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9F9ABFD91FAE0ED40021156B /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0900; + LastUpgradeCheck = 0900; + ORGANIZATIONNAME = "Hakyung Noah"; + TargetAttributes = { + 9F9ABFE01FAE0ED40021156B = { + CreatedOnToolsVersion = 9.0; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 9F9ABFDC1FAE0ED40021156B /* Build configuration list for PBXProject "HelloiPhone" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 9F9ABFD81FAE0ED40021156B; + productRefGroup = 9F9ABFE21FAE0ED40021156B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 9F9ABFE01FAE0ED40021156B /* HelloiPhone */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 9F9ABFDF1FAE0ED40021156B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9F9ABFEF1FAE0ED40021156B /* LaunchScreen.storyboard in Resources */, + 9F9ABFEC1FAE0ED40021156B /* Assets.xcassets in Resources */, + 9F9ABFEA1FAE0ED40021156B /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 9F9ABFDD1FAE0ED40021156B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9F9ABFE71FAE0ED40021156B /* ViewController.swift in Sources */, + 9F9ABFE51FAE0ED40021156B /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 9F9ABFE81FAE0ED40021156B /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9F9ABFE91FAE0ED40021156B /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 9F9ABFED1FAE0ED40021156B /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9F9ABFEE1FAE0ED40021156B /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 9F9ABFF11FAE0ED40021156B /* 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_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_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 = 11.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 9F9ABFF21FAE0ED40021156B /* 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_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_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 = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 9F9ABFF41FAE0ED40021156B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = TZCQN9XXN6; + INFOPLIST_FILE = HelloiPhone/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.InterfaceProgramming2.www.HelloiPhone; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 9F9ABFF51FAE0ED40021156B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = TZCQN9XXN6; + INFOPLIST_FILE = HelloiPhone/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.InterfaceProgramming2.www.HelloiPhone; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 9F9ABFDC1FAE0ED40021156B /* Build configuration list for PBXProject "HelloiPhone" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9F9ABFF11FAE0ED40021156B /* Debug */, + 9F9ABFF21FAE0ED40021156B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9F9ABFF31FAE0ED40021156B /* Build configuration list for PBXNativeTarget "HelloiPhone" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9F9ABFF41FAE0ED40021156B /* Debug */, + 9F9ABFF51FAE0ED40021156B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9F9ABFD91FAE0ED40021156B /* Project object */; +} diff --git a/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..ca797d8 --- /dev/null +++ b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/AppDelegate.swift b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/AppDelegate.swift new file mode 100644 index 0000000..e8a9ceb --- /dev/null +++ b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// HelloiPhone +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/Assets.xcassets/AppIcon.appiconset/Contents.json b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..1d060ed --- /dev/null +++ b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,93 @@ +{ + "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" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/Base.lproj/LaunchScreen.storyboard b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f83f6fd --- /dev/null +++ b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/Base.lproj/Main.storyboard b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/Base.lproj/Main.storyboard new file mode 100644 index 0000000..4b09c44 --- /dev/null +++ b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/Base.lproj/Main.storyboard @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/Info.plist b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/Info.plist new file mode 100644 index 0000000..16be3b6 --- /dev/null +++ b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/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/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/ViewController.swift b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/ViewController.swift new file mode 100644 index 0000000..f53581c --- /dev/null +++ b/Chapter1/Project Files/Swift 4/HelloiPhone/HelloiPhone/ViewController.swift @@ -0,0 +1,30 @@ +// +// ViewController.swift +// HelloiPhone +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + @IBOutlet var myLabel: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + @IBAction func change(_ sender: Any) { + myLabel.text = "Hello World" + } + +} + diff --git a/Chapter1/README.md b/Chapter1/ReadmeAndSlides/README.md similarity index 100% rename from Chapter1/README.md rename to Chapter1/ReadmeAndSlides/README.md diff --git a/Chapter1/Session_1_1_IntroXcode.pdf b/Chapter1/ReadmeAndSlides/Session_1_1_IntroXcode.pdf similarity index 100% rename from Chapter1/Session_1_1_IntroXcode.pdf rename to Chapter1/ReadmeAndSlides/Session_1_1_IntroXcode.pdf diff --git a/Chapter1/Session_1_2_Storyboard.pdf b/Chapter1/ReadmeAndSlides/Session_1_2_Storyboard.pdf similarity index 100% rename from Chapter1/Session_1_2_Storyboard.pdf rename to Chapter1/ReadmeAndSlides/Session_1_2_Storyboard.pdf diff --git a/Chapter1/Session_1_3_Interaction.pdf b/Chapter1/ReadmeAndSlides/Session_1_3_Interaction.pdf similarity index 100% rename from Chapter1/Session_1_3_Interaction.pdf rename to Chapter1/ReadmeAndSlides/Session_1_3_Interaction.pdf diff --git a/Chapter1/Session_1_3_Simulator.pdf b/Chapter1/ReadmeAndSlides/Session_1_3_Simulator.pdf similarity index 100% rename from Chapter1/Session_1_3_Simulator.pdf rename to Chapter1/ReadmeAndSlides/Session_1_3_Simulator.pdf diff --git a/Chapter1/Session_1_5_Multitasking.pdf b/Chapter1/ReadmeAndSlides/Session_1_5_Multitasking.pdf similarity index 100% rename from Chapter1/Session_1_5_Multitasking.pdf rename to Chapter1/ReadmeAndSlides/Session_1_5_Multitasking.pdf diff --git a/Chapter1/Session_1_6_Sandbox.pdf b/Chapter1/ReadmeAndSlides/Session_1_6_Sandbox.pdf similarity index 100% rename from Chapter1/Session_1_6_Sandbox.pdf rename to Chapter1/ReadmeAndSlides/Session_1_6_Sandbox.pdf diff --git a/Chapter2/Session2.playground/Contents.swift b/Chapter2/Project Files/Swift 2(old)/Session2.playground/Contents.swift similarity index 100% rename from Chapter2/Session2.playground/Contents.swift rename to Chapter2/Project Files/Swift 2(old)/Session2.playground/Contents.swift diff --git a/Chapter2/Session2.playground/contents.xcplayground b/Chapter2/Project Files/Swift 2(old)/Session2.playground/contents.xcplayground similarity index 100% rename from Chapter2/Session2.playground/contents.xcplayground rename to Chapter2/Project Files/Swift 2(old)/Session2.playground/contents.xcplayground diff --git a/Chapter2/Session2.playground/timeline.xctimeline b/Chapter2/Project Files/Swift 2(old)/Session2.playground/timeline.xctimeline similarity index 100% rename from Chapter2/Session2.playground/timeline.xctimeline rename to Chapter2/Project Files/Swift 2(old)/Session2.playground/timeline.xctimeline diff --git a/Chapter2/Project Files/Swift 4/Session2.playground/Contents.swift b/Chapter2/Project Files/Swift 4/Session2.playground/Contents.swift new file mode 100644 index 0000000..cdae22d --- /dev/null +++ b/Chapter2/Project Files/Swift 4/Session2.playground/Contents.swift @@ -0,0 +1,629 @@ +//: Playground - noun: a place where people can play + +import UIKit + +//: Session 2-2 + +let maxSpeed:Int = 200 +//maxSpeed += 10 + +var currentSpeed:Int = 110 +currentSpeed += 10 +//currentSpeed += 20.5 + +//: Session 2-3 + +let name:String = "Seongkwan" +var greeting = "Hello" +greeting += " " + name + +let characters = name.characters +let count = characters.count + +let url = "www.codershigh.com" +let hasProtocol:Bool = url.hasPrefix("http://") + +print("\(name)") +print("\(name) has \(count) characters") + +//currentSpeed += Int(20.5) + +let intMax = Int.max +let UintMax = UInt.max +let intMin = Int.min +let UintMin = UInt.min + +let pi = 3.14 +let divider = 2 +//let halfPi = 3.14/divider +let halfPi = 3.14/Double(divider) + + +//: Session 2-4 튜플 + +let time1 = (9,0,48) +time1.0 +let time2:(h:Int, m:Int, s:Int) = (11,51,5) +time2.h + +let duration = (time1, time2) +let (start, end) = duration +let endHour = end.h + +typealias Time = (h:Int, m:Int, s:Int) +typealias Duration = (start:Time, end:Time) + +let today:Duration = ((9,10,23), (17,8,21)) +print("We studied \(today.end.h - today.start.h) hours today") + + +//: Session 2-5 컬렉션 +//:: Dictionary + +var meetingRooms:Array = ["Banksy", "Rivera", "Kahlo", "Picasso", "Cezanne", "Matisse"] +var groups:[Int] = [10, 8, 14, 9] + +meetingRooms += ["Renoir"] + + +var speedHistory:[Int] = [] +speedHistory += [currentSpeed] +let gpsSpeed0901 = 114.1 +speedHistory.append(Int(gpsSpeed0901)) + +speedHistory[0] +speedHistory.last + + + +let historyBackup = speedHistory +speedHistory += [150] +historyBackup + +//: Session 2-6 컬렉션2 Dictionary +var roomCapacity:[String:Int] = ["Banksy":4, "Rivera":8, "Kahlo":8, "Picasso":10, "Cezanne":20, "Matisse":30] + +//roomCapacity += ["Renoir":40] +roomCapacity["Renoir"] = 40 +roomCapacity["Kahlo"] + +//let roomNames = roomCapacity.keys +//let capacities = roomCapacity.values + + +let roomNames = [String](roomCapacity.keys) +let capacities = [Int](roomCapacity.values) + +let total = capacities.reduce(0, +) + +//: Session 2-6 컬렉션2 Set +let subway2 :Set = ["시청", "을지로입구", "을지로3가", "을지로4가","동대문역사문화공원", "신당", "상왕십리", "왕십리", "한양대", "뚝섬", "성수", "건대입구", "구의", "강변", "잠실나루", "잠실", "신천", "종합운동장", "삼성", "선릉", "역삼", "강남", "교대", "서초", "방배", "사당", "낙성대", "서울대입구", "봉천", "신림", "신대방", "구로디지털단지", "대림", "신도림", "문래", "영등포구청", "당산", "합정", "홍대입구", "신촌", "이대", "아현", "충정로"] +subway2.count + +let subway3 :Set = ["지축", "구파발", "연신내", "불광", "녹번", "홍제", "무악재", "독립문", "경복궁", "안국", "종로3가", "을지로3가", "충무로", "동대입구", "약수", "금호", "옥수", "압구정", "신사", "잠원", "고속터미널", "교대", "남부터미널", "양재", "매봉", "도곡", "대치", "학여울", "대청", "일원", "수서", "가락시장", "경찰병원", "오금"] +subway3.count + +let transfer = subway2.intersection(subway3) +transfer.count +let notTransfer = subway2.subtracting(subway3) +notTransfer.count + +let union = subway2.union(subway3) +union.count +let exOR = subway2.symmetricDifference(subway3) +exOR.count + +if transfer.count > 0 { + print("환승역은 \(transfer) 입니다.") +} else { + print("환승역은 없습니다.") +} + +for station in subway2 { + print("이번 역은 \(station)입니다.") +} + +for i in 0...3 { + print("\(i+1) 번째 회의실은 \(roomNames[i])입니다.") +} + +for (roomName, capacity) in roomCapacity { + "\(roomName)의 정원은 \(capacity)명입니다." +} + + +for (roomName, capacity) in roomCapacity { + let roomDescription:String + switch capacity { + case 4: + roomDescription = "\(roomName)은 스터디 룸이며 정원은 \(capacity)명입니다." + case 5...10: + roomDescription = "\(roomName)은 팀 세미나 룸이며 정원은 \(capacity)명입니다." + case 11...30: + roomDescription = "\(roomName)은 그룹 세미나 룸이며 정원은 \(capacity)명입니다." + case let caseCapacity where caseCapacity > 30: + roomDescription = "\(roomName)의 정원은 \(capacity)명이며 별도의 사용신청이 필요합니다." + default: + roomDescription = "\(roomName)의 정보를 다시 확인해 주세요" + } + print("\(roomDescription)") +} + + +//: Session 2-8 옵셔널 + +var title : String = "Storyboard Prototyping" +var ratings : [Double]? = nil +var supportURL : String? = nil + +//print ("\(title) has \(ratings!.count) ratings. \r\nsupport web page : \(supportURL)") + +//: Session 2-9 옵셔널 +supportURL = "www.codershigh.com" + +var bookDescription:String = "\(title)" +if ratings != nil { + bookDescription += "has \(ratings!.count) ratings" +} +if supportURL != nil { + bookDescription += "\r\nsupport web page: \(supportURL!)" +} + +print("\(bookDescription)") + +//: Session 2-10 옵셔널 +if let theRatings = ratings { + bookDescription += "has \(theRatings.count) ratings" +} +if let theURL = supportURL { + bookDescription += "\r\nsupport web page: \(theURL)" +} + +var supportingURL : String! = nil +supportingURL = "www.codershigh.com" +bookDescription += "\r\nsupport web page: \(supportingURL)" + + + +//: Session 2-11 Functions + +func ratingRecord (_ history:[Double]) -> (average:Double, min:Double, max:Double)? { + + if history.count == 0 { return nil } + + var sum = 0.0, min = history[0], max = history[0] + + for value in history { + if min > value { min = value } + if max < value { max = value } + sum += value + } + + let average = sum / Double(history.count) + return (average, min, max) +} + +ratings = [3.5, 2.0, 4.5, 5.0] +bookDescription = "\(title)" + +if let theRatings = ratings , let record = ratingRecord(theRatings) { + bookDescription += " has \(theRatings.count) ratings, \r\n average is \(record.average), from \(record.min) to \(record.max)" +} else { + bookDescription += " has no ratings yet" +} + + +bookDescription + +/* +1. record의 Type을 명시하시오 +2. ratings = [] 일때 문제 해결 방식 고민 +*/ +//: Session 2-12 Structure + +_={ + +struct Task { + var title:String//? + var time:Int? +} + +var callTask = Task(title: "Call to Randy", time: 10*60) +//var reportTask = Task() +var reportTask = Task(title:"Report to Boss", time: nil) + +var todayTask:[Task] = [] +todayTask += [callTask, reportTask] +todayTask[1].time = 15*60 + +callTask.title = "Call to Toby" +print("today task = \(todayTask) \r\n callTask = \(callTask)") + +} + +//: Session 2-13 Class +_={ + +class Employee { + var name:String? + var phoneNumber:String? + var boss:Employee? +} + +struct Task { + var title:String + var time:Int? + + var owner:Employee + var participant:Employee? +} + + let me:Employee = Employee() + me.name = "Alex" + me.phoneNumber = "010-1234-5678" + + let toby:Employee = Employee() + toby.name = "Toby" + toby.phoneNumber = "011-5678-1234" + + var callTask = Task(title: "Call to Toby", time: 10*60, owner:me, participant:toby) + var reportTask = Task(title:"Report to Boss", time: nil, owner:me, participant:nil) + callTask.participant?.phoneNumber = "010-5678-1234" + + var todayTask:[Task] = [] + todayTask += [callTask, reportTask] + todayTask[1].time = 15*60 +} + + +//: Session 2-14 Enumerations +_={ + + class Employee { + var name:String? + var phoneNumber:String? + var boss:Employee? + } + + struct Task { + var title:String + var time:Int? + + var owner:Employee + var participant:Employee? + + var type:TaskType + + enum TaskType { + case call + case report + case meet + case support + + var typeTitle:String { + get { + let titleString:String + switch self { + case .call: + titleString = "Call" + case .report: + titleString = "Report" + case .meet: + titleString = "Meet" + case .support: + titleString = "Support" + } + return titleString + } + } + } + } + + let me:Employee = Employee() + me.name = "Alex" + me.phoneNumber = "010-1234-5678" + + let toby:Employee = Employee() + toby.name = "Toby" + toby.phoneNumber = "011-5678-1234" + + var callTask = Task(title: "Call to Toby", time: 10*60, owner:me, participant:toby, type:.call) + var reportTask = Task(title:"Report to Boss", time: nil, owner:me, participant:nil, type:Task.TaskType.report) + + callTask.participant?.phoneNumber = "010-5678-1234" + + var todayTask:[Task] = [] + todayTask += [callTask, reportTask] + todayTask[1].time = 15*60 +} + + +//: Session 2-15 Initialize +_={ + + class Employee { + var name:String? + var phoneNumber:String? + var boss:Employee? + + init (name:String){ + self.name = name + } + convenience init (name:String, phone:String) { + self.init(name:name) + self.phoneNumber = phone + } + } + + struct Task { + var title:String + var time:Int? + + var owner:Employee + var participant:Employee? + + var type:TaskType + + enum TaskType { + case call + case report + case meet + case support + + var typeTitle:String { + get { + let titleString:String + switch self { + case .call: + titleString = "Call" + case .report: + titleString = "Report" + case .meet: + titleString = "Meet" + case .support: + titleString = "Support" + } + return titleString + } + } + } + + init (type:TaskType, owner:Employee) { + self.type = type + self.title = type.typeTitle + self.owner = owner + self.time = nil + self.participant = nil + } + } + + let me:Employee = Employee(name: "Alex", phone:"010-1234-5678") + + let toby:Employee = Employee(name: "Toby") + toby.phoneNumber = "011-5678-1234" + + var callTask = Task(type:.call, owner:me) + callTask.time = 10*60 + var reportTask = Task(type:.report, owner:me) + + callTask.participant?.phoneNumber = "010-5678-1234" + + var todayTask:[Task] = [] + todayTask += [callTask, reportTask] + todayTask[1].time = 15*60 +} + +//: Session 2-16 Method +_={ + + class Employee { + var name:String? + var phoneNumber:String? + var boss:Employee? + + init (name:String){ + self.name = name + } + convenience init (name:String, phone:String) { + self.init(name:name) + self.phoneNumber = phone + } + + func report() { + if let myBoss = boss { + print("\(String(describing: self.name)) reported to \(String(describing: myBoss.name))") + } else { + print("\(String(describing: name)) don't have boss") + } + } + + func callTaskToBoss() -> Task? { + if let myBoss = boss, let callTo = myBoss.phoneNumber { + let callTask = Task(type: .call, owner: self) + return callTask + } + return nil + } + } + + struct Task { + var title:String + var time:Int? + + var owner:Employee + var participant:Employee? + + var type:TaskType + + enum TaskType { + case call + case report + case meet + case support + + var typeTitle:String { + get { + let titleString:String + switch self { + case .call: + titleString = "Call" + case .report: + titleString = "Report" + case .meet: + titleString = "Meet" + case .support: + titleString = "Support" + } + return titleString + } + } + } + + init (type:TaskType, owner:Employee) { + self.type = type + self.title = type.typeTitle + self.owner = owner + self.time = nil + self.participant = nil + } + } + + var todayTask:[Task] = [] + + let me:Employee = Employee(name: "Alex", phone:"010-1234-5678") + + let toby:Employee = Employee(name: "Toby") + toby.phoneNumber = "011-5678-1234" + + me.boss = toby + me.report() + + var reportTask = Task(type:.report, owner:me) + todayTask += [reportTask] + + if let callTask = me.callTaskToBoss() { + todayTask += [callTask] + } +} + +//: Session 2-17 Enum Associated Value +enum Barcode { + case upca(Int, Int, Int, Int) + case qrCode(String) +} + +var productBarcode = Barcode.upca(8, 85909, 51226, 3) +productBarcode = .qrCode("ABCDEFGHIJKLMNOP") + +_={ + + class Employee { + var name:String? + var phoneNumber:String? + var boss:Employee? + + init (name:String){ + self.name = name + } + convenience init (name:String, phone:String) { + self.init(name:name) + self.phoneNumber = phone + } + + func report() { + if let myBoss = boss { + print("\(String(describing: self.name)) reported to \(myBoss.name)") + } else { + print("\(String(describing: name)) don't have boss") + } + } + + func callTaskToBoss() -> Task? { + if let myBoss = boss, let callTo = myBoss.phoneNumber { + let callTask = Task(type: .call(number:callTo), owner: self) + return callTask + } + return nil + } + } + + struct Task { + var title:String + var time:Int? + + var owner:Employee + //var participant:Employee? + + var type:TaskType + + enum TaskType { + case call(number:String) + case report(to:Employee, when:String) + case meet(with:Employee, location:String) + case support(who:Employee, duration:Int) + + var typeTitle:String { + get { + let titleString:String + switch self { + case .call: + titleString = "Call" + case .report: + titleString = "Report" + case .meet: + titleString = "Meet" + case .support: + titleString = "Support" + } + return titleString + } + } + } + + init (type:TaskType, owner:Employee) { + self.type = type + self.title = type.typeTitle + self.owner = owner + self.time = nil + //self.participant = nil + } + + func doBasicTask() ->String { + let taskDescription:String + switch type { + case .call(let number) : + taskDescription = "\(String(describing: owner.name)) make a call to \(number)" + case .report(let receiver, let time) : + taskDescription = "\(String(describing: owner.name)) report to \(String(describing: receiver.name)) at \(time)" + case .meet(let participant, let location) : + taskDescription = "\(String(describing: owner.name)) meet \(String(describing: participant.name)) at \(location)" + case .support(let taskOwner, let duration) : + taskDescription = "\(String(describing: owner.name)) support \(String(describing: taskOwner.name)) for \(duration) days" + default: + taskDescription = "Need more information for task." + } + return taskDescription + } + } + + var todayTask:[Task] = [] + + let me:Employee = Employee(name: "Alex", phone:"010-1234-5678") + + let toby:Employee = Employee(name: "Toby") + toby.phoneNumber = "011-5678-1234" + + me.boss = toby + me.report() + + var reportTask = Task(type:.report(to:toby, when:"Afternoon"), owner:me) + todayTask += [reportTask] + + if let callTask = me.callTaskToBoss() { + todayTask += [callTask] + callTask.doBasicTask() + } + + reportTask.doBasicTask() +} + diff --git a/Chapter2/Project Files/Swift 4/Session2.playground/contents.xcplayground b/Chapter2/Project Files/Swift 4/Session2.playground/contents.xcplayground new file mode 100644 index 0000000..cd0e2b9 --- /dev/null +++ b/Chapter2/Project Files/Swift 4/Session2.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Chapter2/Project Files/Swift 4/Session2.playground/playground.xcworkspace/contents.xcworkspacedata b/Chapter2/Project Files/Swift 4/Session2.playground/playground.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Chapter2/Project Files/Swift 4/Session2.playground/playground.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Chapter2/Project Files/Swift 4/Session2.playground/timeline.xctimeline b/Chapter2/Project Files/Swift 4/Session2.playground/timeline.xctimeline new file mode 100644 index 0000000..022f41c --- /dev/null +++ b/Chapter2/Project Files/Swift 4/Session2.playground/timeline.xctimeline @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Chapter2/README.md b/Chapter2/ReadmeAndSlides/README.md similarity index 100% rename from Chapter2/README.md rename to Chapter2/ReadmeAndSlides/README.md diff --git a/Chapter2/Session_2_12_Structure.pdf b/Chapter2/ReadmeAndSlides/Session_2_12_Structure.pdf similarity index 100% rename from Chapter2/Session_2_12_Structure.pdf rename to Chapter2/ReadmeAndSlides/Session_2_12_Structure.pdf diff --git a/Chapter2/Session_2_13_Class.pdf b/Chapter2/ReadmeAndSlides/Session_2_13_Class.pdf similarity index 100% rename from Chapter2/Session_2_13_Class.pdf rename to Chapter2/ReadmeAndSlides/Session_2_13_Class.pdf diff --git a/Chapter2/Session_2_14_Enumerations.pdf b/Chapter2/ReadmeAndSlides/Session_2_14_Enumerations.pdf similarity index 100% rename from Chapter2/Session_2_14_Enumerations.pdf rename to Chapter2/ReadmeAndSlides/Session_2_14_Enumerations.pdf diff --git a/Chapter2/Session_2_14_Initialize.pdf b/Chapter2/ReadmeAndSlides/Session_2_14_Initialize.pdf similarity index 100% rename from Chapter2/Session_2_14_Initialize.pdf rename to Chapter2/ReadmeAndSlides/Session_2_14_Initialize.pdf diff --git a/Chapter2/Session_2_17_AssociatedValue.pdf b/Chapter2/ReadmeAndSlides/Session_2_17_AssociatedValue.pdf similarity index 100% rename from Chapter2/Session_2_17_AssociatedValue.pdf rename to Chapter2/ReadmeAndSlides/Session_2_17_AssociatedValue.pdf diff --git a/Chapter2/Session_2_1_Swift.pdf b/Chapter2/ReadmeAndSlides/Session_2_1_Swift.pdf similarity index 100% rename from Chapter2/Session_2_1_Swift.pdf rename to Chapter2/ReadmeAndSlides/Session_2_1_Swift.pdf diff --git a/Chapter2/Session_2_2_LetVar.pdf b/Chapter2/ReadmeAndSlides/Session_2_2_LetVar.pdf similarity index 100% rename from Chapter2/Session_2_2_LetVar.pdf rename to Chapter2/ReadmeAndSlides/Session_2_2_LetVar.pdf diff --git a/Chapter2/Session_2_3_BasicTypes.pdf b/Chapter2/ReadmeAndSlides/Session_2_3_BasicTypes.pdf similarity index 100% rename from Chapter2/Session_2_3_BasicTypes.pdf rename to Chapter2/ReadmeAndSlides/Session_2_3_BasicTypes.pdf diff --git a/Chapter2/Session_2_3_TupleTypes.pdf b/Chapter2/ReadmeAndSlides/Session_2_3_TupleTypes.pdf similarity index 100% rename from Chapter2/Session_2_3_TupleTypes.pdf rename to Chapter2/ReadmeAndSlides/Session_2_3_TupleTypes.pdf diff --git a/Chapter2/Session_2_4_Collections1.pdf b/Chapter2/ReadmeAndSlides/Session_2_4_Collections1.pdf similarity index 100% rename from Chapter2/Session_2_4_Collections1.pdf rename to Chapter2/ReadmeAndSlides/Session_2_4_Collections1.pdf diff --git a/Chapter2/Session_2_5_Collections2.pdf b/Chapter2/ReadmeAndSlides/Session_2_5_Collections2.pdf similarity index 100% rename from Chapter2/Session_2_5_Collections2.pdf rename to Chapter2/ReadmeAndSlides/Session_2_5_Collections2.pdf diff --git a/Chapter2/Session_2_7_ControlFlow.pdf b/Chapter2/ReadmeAndSlides/Session_2_7_ControlFlow.pdf similarity index 100% rename from Chapter2/Session_2_7_ControlFlow.pdf rename to Chapter2/ReadmeAndSlides/Session_2_7_ControlFlow.pdf diff --git a/Chapter2/Session_2_8_Optional.pdf b/Chapter2/ReadmeAndSlides/Session_2_8_Optional.pdf similarity index 100% rename from Chapter2/Session_2_8_Optional.pdf rename to Chapter2/ReadmeAndSlides/Session_2_8_Optional.pdf diff --git a/Chapter2/Session_2_9_Function.pdf b/Chapter2/ReadmeAndSlides/Session_2_9_Function.pdf similarity index 100% rename from Chapter2/Session_2_9_Function.pdf rename to Chapter2/ReadmeAndSlides/Session_2_9_Function.pdf diff --git a/Chapter3/README.md b/Chapter3/ReadmeAndSlides/README.md similarity index 100% rename from Chapter3/README.md rename to Chapter3/ReadmeAndSlides/README.md diff --git a/Chapter3/Session_3_1_StartMoneyConverter.pdf b/Chapter3/ReadmeAndSlides/Session_3_1_StartMoneyConverter.pdf similarity index 100% rename from Chapter3/Session_3_1_StartMoneyConverter.pdf rename to Chapter3/ReadmeAndSlides/Session_3_1_StartMoneyConverter.pdf diff --git a/Chapter3/Session_3_2_MoneyClass.pdf b/Chapter3/ReadmeAndSlides/Session_3_2_MoneyClass.pdf similarity index 100% rename from Chapter3/Session_3_2_MoneyClass.pdf rename to Chapter3/ReadmeAndSlides/Session_3_2_MoneyClass.pdf diff --git a/Chapter3/Session_3_2_Views_Controls.pdf b/Chapter3/ReadmeAndSlides/Session_3_2_Views_Controls.pdf similarity index 100% rename from Chapter3/Session_3_2_Views_Controls.pdf rename to Chapter3/ReadmeAndSlides/Session_3_2_Views_Controls.pdf diff --git a/Chapter3/Session_3_4_MoneyStructure.pdf b/Chapter3/ReadmeAndSlides/Session_3_4_MoneyStructure.pdf similarity index 100% rename from Chapter3/Session_3_4_MoneyStructure.pdf rename to Chapter3/ReadmeAndSlides/Session_3_4_MoneyStructure.pdf diff --git a/Chapter3/Session_3_5_MoneyConverter_UI.pdf b/Chapter3/ReadmeAndSlides/Session_3_5_MoneyConverter_UI.pdf similarity index 100% rename from Chapter3/Session_3_5_MoneyConverter_UI.pdf rename to Chapter3/ReadmeAndSlides/Session_3_5_MoneyConverter_UI.pdf diff --git a/Chapter3/Session_3_6_MoneyConverter_Implement.pdf b/Chapter3/ReadmeAndSlides/Session_3_6_MoneyConverter_Implement.pdf similarity index 100% rename from Chapter3/Session_3_6_MoneyConverter_Implement.pdf rename to Chapter3/ReadmeAndSlides/Session_3_6_MoneyConverter_Implement.pdf diff --git a/Chapter4/README.md b/Chapter4/ReadmeAndSlides/README.md similarity index 100% rename from Chapter4/README.md rename to Chapter4/ReadmeAndSlides/README.md diff --git a/Chapter4/Session_4_1_TableView_Intro.pdf b/Chapter4/ReadmeAndSlides/Session_4_1_TableView_Intro.pdf similarity index 100% rename from Chapter4/Session_4_1_TableView_Intro.pdf rename to Chapter4/ReadmeAndSlides/Session_4_1_TableView_Intro.pdf diff --git a/Chapter4/Session_4_1_TableView_Intro_B5.pdf b/Chapter4/ReadmeAndSlides/Session_4_1_TableView_Intro_B5.pdf similarity index 100% rename from Chapter4/Session_4_1_TableView_Intro_B5.pdf rename to Chapter4/ReadmeAndSlides/Session_4_1_TableView_Intro_B5.pdf diff --git a/Chapter4/Session_4_2_StaticeCell_TableView.pdf b/Chapter4/ReadmeAndSlides/Session_4_2_StaticeCell_TableView.pdf similarity index 100% rename from Chapter4/Session_4_2_StaticeCell_TableView.pdf rename to Chapter4/ReadmeAndSlides/Session_4_2_StaticeCell_TableView.pdf diff --git a/Chapter4/Session_4_3_TableViewDataSource.pdf b/Chapter4/ReadmeAndSlides/Session_4_3_TableViewDataSource.pdf similarity index 100% rename from Chapter4/Session_4_3_TableViewDataSource.pdf rename to Chapter4/ReadmeAndSlides/Session_4_3_TableViewDataSource.pdf diff --git a/Chapter4/Session_4_3_TableViewDataSource_B5.pdf b/Chapter4/ReadmeAndSlides/Session_4_3_TableViewDataSource_B5.pdf similarity index 100% rename from Chapter4/Session_4_3_TableViewDataSource_B5.pdf rename to Chapter4/ReadmeAndSlides/Session_4_3_TableViewDataSource_B5.pdf diff --git a/Chapter4/Session_4_4_MasterDetailTemplate.pdf b/Chapter4/ReadmeAndSlides/Session_4_4_MasterDetailTemplate.pdf similarity index 100% rename from Chapter4/Session_4_4_MasterDetailTemplate.pdf rename to Chapter4/ReadmeAndSlides/Session_4_4_MasterDetailTemplate.pdf diff --git a/Chapter4/Session_4_6_MeetingRoomsDynamic.pdf b/Chapter4/ReadmeAndSlides/Session_4_6_MeetingRoomsDynamic.pdf similarity index 100% rename from Chapter4/Session_4_6_MeetingRoomsDynamic.pdf rename to Chapter4/ReadmeAndSlides/Session_4_6_MeetingRoomsDynamic.pdf diff --git a/Chapter5/SwiftFunctionType.playground/Contents.swift b/Chapter5/Project Files/Swift 2(old)/SwiftFunctionType.playground/Contents.swift similarity index 100% rename from Chapter5/SwiftFunctionType.playground/Contents.swift rename to Chapter5/Project Files/Swift 2(old)/SwiftFunctionType.playground/Contents.swift diff --git a/Chapter5/SwiftFunctionType.playground/contents.xcplayground b/Chapter5/Project Files/Swift 2(old)/SwiftFunctionType.playground/contents.xcplayground similarity index 100% rename from Chapter5/SwiftFunctionType.playground/contents.xcplayground rename to Chapter5/Project Files/Swift 2(old)/SwiftFunctionType.playground/contents.xcplayground diff --git a/Chapter5/SwiftFunctionType.playground/timeline.xctimeline b/Chapter5/Project Files/Swift 2(old)/SwiftFunctionType.playground/timeline.xctimeline similarity index 100% rename from Chapter5/SwiftFunctionType.playground/timeline.xctimeline rename to Chapter5/Project Files/Swift 2(old)/SwiftFunctionType.playground/timeline.xctimeline diff --git a/Chapter5/Project Files/Swift 4/SwiftFunctionType.playground/Contents.swift b/Chapter5/Project Files/Swift 4/SwiftFunctionType.playground/Contents.swift new file mode 100644 index 0000000..eeb1a1a --- /dev/null +++ b/Chapter5/Project Files/Swift 4/SwiftFunctionType.playground/Contents.swift @@ -0,0 +1,188 @@ +//: Playground - noun: a place where people can play + +import UIKit + +//: Session 5-1 Function Types + +/*func addVAT(source:Double) -> Double { + return source * 1.1 +}*/ + +func couponDiscount(_ source:Double) -> Double { + return source * 0.9 +} + + +var additional:(Double) -> Double + +let transcation3219 = 120.7 +additional = addVAT + +let price3219 = additional(transcation3219) + +func finalPrice(_ source:Double, additional:(Double) -> Double) -> Double { + + let price = additional(source) + + return price +} + +let price3220 = finalPrice(350.0, additional: couponDiscount) + + +//: Session 5-2 Closure + +let addVATClosure = { (source:Double) -> Double in + return source * 1.1 +} + +let addVATClosure2 = { source in + return source * 1.1 +} + +let addVATClosure3 = { source in + source * 1.1 +} + +let addVATClosure4 = { $0 * 1.1 } + +let couponDiscountClosure = { (source:Double) -> Double in + return source * 0.9 +} + +let couponDiscountClosure2 = { source in + return source * 0.9 +} + +let couponDiscountClosure3 = { source in + source * 0.9 +} + +let couponDiscountClosure4 = { $0 * 0.9 } + +let price3221 = addVATClosure4(157.6) + + +/*func makeAdder (x:Int) -> (Int) -> Int { + func adder(a:Int) -> Int { + return x+a + } + return adder +}*/ + +/*func makeAdder(x:Int) -> (Int) -> Int { + let adder:(Int) -> Int = { + return $0 + x + } + return adder +}*/ + +func makeAdder(_ x:Int) -> (Int) -> Int { + return { + return $0 + x; + } +} + +let add5 = makeAdder(5) +let add10 = makeAdder(10) + +print(add5(2)) +print(add10(2)) + +print(makeAdder(5)(2)) + + +//: Session 5-6 map +let transactions = [560.0, 321.5, 190.0, 672.8, 1190.0, 450.0] + +func addVAT(_ source:Double) -> Double { + return source * 1.1 +} + +var vatPrices:[Double] = [] +for transaction in transactions { + vatPrices += [addVAT(transaction)] +} + +let vatMapPrices = transactions.map({ transaction -> Double in + return transaction * 1.1 +}) + +let vatMapPrices2 = transactions.map({ $0 * 1.1 }) + + +//: Session 5-7 filter +var bigTransactions:[Double] = [] +for price in vatPrices { + if price >= 500 { + bigTransactions += [price] + } +} + +let bigFilterTransactions = vatPrices.filter{ $0 >= 500 } + +var meetingRooms:[String:Int] = ["Banksy":4, "Rivera":8, "Kahlo":8, "Picasso":10, "Cezanne":20, "Matisse":30] + +let members = 9 +let available = meetingRooms.filter{ $0.1 > members} +print(available) + + +//: Session 5-8 sort + +func ascendantSort (_ sort1:Double, sort2:Double) -> Bool { + return sort1 > sort2 +} + +let sortedPrices = vatPrices.sorted(by: ascendantSort) +let sortedPrices2 = vatPrices.sorted(by: { sort1, sort2 in + return sort1 > sort2 +}) +let sortedPrices3 = vatPrices.sorted(by: { $0 > $1 }) +let sortedPrices4 = vatPrices.sorted( by: > ) + +let sortedMeetingRooms = meetingRooms.sorted(by: {$0.1 > $1.1}) +print("\(sortedMeetingRooms)") + +//: Session 5-9 reduce + + +func priceSum (_ base:Double, adder:Double) -> Double { + return base + adder +} + +var sum:Double = 0.0 + +for price in vatPrices { + sum = priceSum(sum, adder: price) +} + +print("\(sum)") +var sum2:Double = 0.0 +let sumReduce = vatPrices.reduce(sum2, priceSum) +let sumReduce2 = vatPrices.reduce(0.0, { base, adder in + base + adder +}) +let sumReduce3 = vatPrices.reduce(0, +) + + +let pricesInString = vatPrices.reduce("", {$0 + "\($1)\n"}) + +print(pricesInString) + + +let descriptionString = meetingRooms.reduce("We have meeting rooms : \n", { $0 + "\($1.0) for \($1.1) person \n" + +}) + +print(descriptionString) + +//: Session 5-10 MeetingRooms 정렬 + + +let x = [10, 3, 20, 15, 4].sorted {$0 < $1}.filter { $0 > 5 }.map { $0 * 100 } + +let x2 = [10, 3, 20, 15, 4].sorted {$0 < $1} +x2 + + diff --git a/Chapter5/Project Files/Swift 4/SwiftFunctionType.playground/contents.xcplayground b/Chapter5/Project Files/Swift 4/SwiftFunctionType.playground/contents.xcplayground new file mode 100644 index 0000000..985588c --- /dev/null +++ b/Chapter5/Project Files/Swift 4/SwiftFunctionType.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Chapter5/Project Files/Swift 4/SwiftFunctionType.playground/playground.xcworkspace/contents.xcworkspacedata b/Chapter5/Project Files/Swift 4/SwiftFunctionType.playground/playground.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Chapter5/Project Files/Swift 4/SwiftFunctionType.playground/playground.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Chapter5/Project Files/Swift 4/SwiftFunctionType.playground/timeline.xctimeline b/Chapter5/Project Files/Swift 4/SwiftFunctionType.playground/timeline.xctimeline new file mode 100644 index 0000000..8020d2c --- /dev/null +++ b/Chapter5/Project Files/Swift 4/SwiftFunctionType.playground/timeline.xctimeline @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/Chapter5/README.md b/Chapter5/ReadmeAndSlides/README.md similarity index 100% rename from Chapter5/README.md rename to Chapter5/ReadmeAndSlides/README.md diff --git "a/Chapter5/Session_5_10_MeetingRoom\354\240\225\353\240\254\355\225\230\352\270\260.pdf" "b/Chapter5/ReadmeAndSlides/Session_5_10_MeetingRoom\354\240\225\353\240\254\355\225\230\352\270\260.pdf" similarity index 100% rename from "Chapter5/Session_5_10_MeetingRoom\354\240\225\353\240\254\355\225\230\352\270\260.pdf" rename to "Chapter5/ReadmeAndSlides/Session_5_10_MeetingRoom\354\240\225\353\240\254\355\225\230\352\270\260.pdf" diff --git a/Chapter5/Session_5_1_FunctionType.pdf b/Chapter5/ReadmeAndSlides/Session_5_1_FunctionType.pdf similarity index 100% rename from Chapter5/Session_5_1_FunctionType.pdf rename to Chapter5/ReadmeAndSlides/Session_5_1_FunctionType.pdf diff --git a/Chapter5/Session_5_2_Closure.pdf b/Chapter5/ReadmeAndSlides/Session_5_2_Closure.pdf similarity index 100% rename from Chapter5/Session_5_2_Closure.pdf rename to Chapter5/ReadmeAndSlides/Session_5_2_Closure.pdf diff --git a/Chapter5/Session_5_6_map.pdf b/Chapter5/ReadmeAndSlides/Session_5_6_map.pdf similarity index 100% rename from Chapter5/Session_5_6_map.pdf rename to Chapter5/ReadmeAndSlides/Session_5_6_map.pdf diff --git a/Chapter5/Session_5_7_filter.pdf b/Chapter5/ReadmeAndSlides/Session_5_7_filter.pdf similarity index 100% rename from Chapter5/Session_5_7_filter.pdf rename to Chapter5/ReadmeAndSlides/Session_5_7_filter.pdf diff --git a/Chapter5/Session_5_8_sort.pdf b/Chapter5/ReadmeAndSlides/Session_5_8_sort.pdf similarity index 100% rename from Chapter5/Session_5_8_sort.pdf rename to Chapter5/ReadmeAndSlides/Session_5_8_sort.pdf diff --git a/Chapter5/Session_5_9_reduce.pdf b/Chapter5/ReadmeAndSlides/Session_5_9_reduce.pdf similarity index 100% rename from Chapter5/Session_5_9_reduce.pdf rename to Chapter5/ReadmeAndSlides/Session_5_9_reduce.pdf diff --git a/Chapter6/README.md b/Chapter6/ReadmeAndSlides/README.md similarity index 100% rename from Chapter6/README.md rename to Chapter6/ReadmeAndSlides/README.md diff --git a/Chapter6/Session_6_1_ViewController.pdf b/Chapter6/ReadmeAndSlides/Session_6_1_ViewController.pdf similarity index 100% rename from Chapter6/Session_6_1_ViewController.pdf rename to Chapter6/ReadmeAndSlides/Session_6_1_ViewController.pdf diff --git a/Chapter6/Session_6_3_Navigation.pdf b/Chapter6/ReadmeAndSlides/Session_6_3_Navigation.pdf similarity index 100% rename from Chapter6/Session_6_3_Navigation.pdf rename to Chapter6/ReadmeAndSlides/Session_6_3_Navigation.pdf diff --git a/Chapter6/Session_6_5_TabBar.pdf b/Chapter6/ReadmeAndSlides/Session_6_5_TabBar.pdf similarity index 100% rename from Chapter6/Session_6_5_TabBar.pdf rename to Chapter6/ReadmeAndSlides/Session_6_5_TabBar.pdf diff --git a/Chapter7/README.md b/Chapter7/ReadmeAndSlides/README.md similarity index 100% rename from Chapter7/README.md rename to Chapter7/ReadmeAndSlides/README.md diff --git a/Chapter7/Session_7_1_ModalContext.pdf b/Chapter7/ReadmeAndSlides/Session_7_1_ModalContext.pdf similarity index 100% rename from Chapter7/Session_7_1_ModalContext.pdf rename to Chapter7/ReadmeAndSlides/Session_7_1_ModalContext.pdf diff --git a/Chapter7/Session_7_3_ModalAdd.pdf b/Chapter7/ReadmeAndSlides/Session_7_3_ModalAdd.pdf similarity index 100% rename from Chapter7/Session_7_3_ModalAdd.pdf rename to Chapter7/ReadmeAndSlides/Session_7_3_ModalAdd.pdf diff --git a/Chapter8/README.md b/Chapter8/ReadmeAndSlides/README.md similarity index 100% rename from Chapter8/README.md rename to Chapter8/ReadmeAndSlides/README.md diff --git "a/Chapter8/Session_8_1_\354\240\200\354\236\245\355\225\230\352\270\260\354\230\244\353\262\204\353\267\260.pdf" "b/Chapter8/ReadmeAndSlides/Session_8_1_\354\240\200\354\236\245\355\225\230\352\270\260\354\230\244\353\262\204\353\267\260.pdf" similarity index 100% rename from "Chapter8/Session_8_1_\354\240\200\354\236\245\355\225\230\352\270\260\354\230\244\353\262\204\353\267\260.pdf" rename to "Chapter8/ReadmeAndSlides/Session_8_1_\354\240\200\354\236\245\355\225\230\352\270\260\354\230\244\353\262\204\353\267\260.pdf" diff --git a/Converted by Andrew Noh/README.md b/Converted by Andrew Noh/README.md new file mode 100644 index 0000000..bf1f56a --- /dev/null +++ b/Converted by Andrew Noh/README.md @@ -0,0 +1,544 @@ +# SwiftBasics +Swift basic tutorial notes +온라인 강좌 수강하며 개인적으로 적은 노트 레포지토리입니다. + +##Original repo: [https://github.com/andrew-noh/SwiftBasics](https://github.com/andrew-noh/SwiftBasics) + + +## 1) Var & Let + +var //변수, mutable + +let //상수, immutable/unchangable + +if let //옵셔널 바인딩은 옵셔널의 값이 존재하는지를 검사한 뒤, 존재한다면 그 값을 다른 변수에 대입시켜줌. + +if let 또는 if var를 사용. 옵셔널의 값을 벗겨서 값이 있다면 if문 안으로 들어가고, 값이 nil이라면 그냥 통과하게 됨. + +guard let //if let과 유사하나 if문을 통하지 않고 else로 예외처리만 함 + + +## 2) Data types + +:String //String type text +//"\()" 괄호 안에 val/let 넣어서 string 사이에 입력 가능 +//.hasPrefix   .hasSuffix method 로 T/F value return 가능 + +:Double //기본 64-bit floating-point number + +:Float //32-bit floating-point number ex. 3.14159 + +:Int //Integer(정수) + +:UInt //양의 정수(0 ~ 255) + +let minValue = UInt8.min // minValue is equal to 0, and is of type UInt8 +let maxValue = UInt8.max // maxValue is equal to 255, and is of type UInt8 + +.max method //maximum value +.min method //minimum value + +## 3) Tuple + +Tuple //코마로 구분된 값의 리스트 + +let tupleExample:(a:INT, b:Int, c:Int) = (1, 2, 3) + +(a:INT, b:Int, c:Int) // Typealias + + typealias Time = (h:Int, m:Int, s:Int) + typealias Duration = (start:Time, end:Time) + + let today:Duration = ((9, 10, 23), (17, 8, 21)) + print(\(today.start.h)) + +Tuple : Int, String, Double이 섞여서 들어갈 수 있다. 순서는 정해져있지 않음 + +Array : 순서가 정해져있다. 동일한 타입의 인스턴스만 들어갈 수 있다. + +## 4) Array + +Array 또는 [Type] +Array의 let과 var +Array 안에는 동일한 타입의 인스턴스가 들어가야 함 + + var arrayExample:Array = ["A", "B", "C"] + var groups:[Int] = [1, 2, 3] + +정의하는 법: + + var example:[Int] = [10, 9, 2] + + var example:Array = [9, 8, 7] + ++= [item]으로 append 가능 + +## 5) Dictionary + +*값에 이름표를 붙여 저장하는 상자* + +var roomCapacity:[String: Int] = ["Bansky":4, "Rivera":8] + +roomCapacity["Renoir"] = 40 //값 추가하기 + +roomCapacity["Kahlo"] //name에 대한 key값 불러오기 + + let roomNames = [String](roomCapacity.keys) //arrys with names 새로운 어레이 + let roomNames = roomCapacity.keys //새로운 튜플 + let capacities = [Int](roomCapacity.values) //keys + +let total = capacities.reduce(0, combine: +) + +## 6) Set + +순서를 가지고 있지 않은 컬렉션 + + let subway2 :Set = ["a", "b"] + let subway3 :Set = ["b", "c"] + + let transfer = subway2.intersect(subway3) + +## 7) IF +조건문 + + if [condition] { + + ... + + } + + else { + + ... + + } + +example: + + if transfer.count > 0 { + + print() + + } + + else { + + print() + + } + +## 8) FOR + + for i = 0; i < count ; i++ { + + ... + + } + + for item in collection { + + ... + + } + +## SWITCH + +하나의 값에 대한 다양한 실행 매칭 +default 값이 필요 + + switch [value] { + + case a: + + ... + + case b: + + ... + + default: + + ... + + } + +## WHERE +새로운 변수의 정의 + + case ("beer", let amount) where amount > 100 : + +## OPTIONAL + +값이 없는 상태 (타입 + ?) + +nil : 값이 없음을 나타냄, 모든 타입의 정수가 nil이 될 수 있음, 0 과 다름 + +실행중에 nil이 될 수 있는 변수에 '?' 를 붙여 특별관리하는 방법 (optional) + + var title:String = nil // 에러가 남 + var title:String? = nil //에러 나지 않음 + + var ratings : [Int]? = nil + var supportURL : String? = nil + +## OPTIONAL 접근법 + +Force Unwrapping: ! + +값의 존재를 확신할 때 사용 + + if ratings != nil { + bookDescription += "has \(ratings!.count) ratings" + } + +## OPTIONAL BINDING + +Optional Binding + +if let, if var : Optional이 아닌 새로운 상수와 변수 생성 + +Implicitly Unwrapped Optional + +선언시 ! 사용 : 구조적으로 초기화 이후 항상 값이 존재하는 경우를 위한 장치 + +처음에는 nil값을 가지지만 (그래서 optional 사용), 분명히 값을 가질 경우 선언 시 !를 추가하여 선언 + +var supportURL : String! = nil + +bookDescription += "\r\nsupport web page : \(supportURL)" //supportURL에 optional을 사용할 필요 없음 + + +## OPTIONAL BINDING EXERCISE 1 + + struct WatchDevice { + var pairediPhone:String? //애플와치와 쌍을 이루는 아이폰의 이름. + var appInstalled = false //어플리케이션의 설치 유무 + + enum WatchSize { + case m42, m38 + } + } + + var appleWatch:WatchDevice? = nil + appleWatch = WatchDevice(pairediPhone: "링고스타의 아이폰", appInstalled: true) + + // ①appleWatch에 대해 optional binding으로 watch라는 새로운 변수를 생성해주세요. + if let watch = appleWatch { + // ②watch와 쌍을 이루는 아이폰의 이름에 대해 + // optional binding으로 phoneName이라는 새로운 변수를 생성해 주세요. + if let phoneName = appleWatch?.pairediPhone { + print ("AppleWatch가 \(phoneName)과 쌍을 이룹니다.") + } + } + +## OPTIONAL BINDING EXERCISE 2 + + struct WatchDevice { + var pairediPhone:String? //애플와치와 쌍을 이루는 아이폰의 이름. + var appInstalled = false //어플리케이션의 설치 유무 + + enum WatchSize { + case m42, m38 + } + } + + var appleWatch:WatchDevice! = nil + appleWatch = WatchDevice(pairediPhone: "링고스타의 아이폰", appInstalled: true) + + // appleWatch에 appleWatch에 대해 optional binding으로 phoneName이라는 새로운 변수를 생성해 주세요 + if let phoneName = appleWatch?.pairediPhone { + print ("AppleWatch가 \(phoneName)과 쌍을 이룹니다.") + } + + +## FUNCTION + +**func** + +func functionName (parameter : Type) -> returnType { + +... + +} + + func myFunction () -> Output { + + ... + + return + + } + +## 구조체 + + struct Task { + + var title:String + + var time:Int? + + } + +새로운 구조체 생성시 값이 새로 복사된다. 기존의 구조체의 값을 변경할 경우 기존 구조체를 포함하는 구조체의 해당 값은 변하지 않는다. + +### Example + + struct Car { + let name:String + var distance:Double + } + + // tryCar의 모델명은 "트라이카"이고, 총 주행 거리는 29.9km입니다. + var tryCar:Car = "트라이카" + var distance = "29.9" + + print("tryCar의 모델 명은 \(tryCar.name)이고, 총 주행 거리는 \(tryCar.distance)입니다.") + + +## CLASS + +오브젝트를 생성, 참조로 동작, Swift에서는 Instance 로 자주 사용 + + class Employee { + + var name:String? + var phoneNumber:String? + var boss:Employee? + + } + +참조하기 때문에 내부 데이터를 변경할 시 전부 변경됨, 서로 연결됨 + +## ENUM + +연관성 있는 값들의 그룹을 만들어 Type-Safe 하게 사용 + +일련의 값을 주지 않아도 됨(raw value) + +enum = 1st Class type : 어디에나 사용될 수 있는 자격 + + struct Task { + var title:String? + var time:Int? + var owner:Employee + var participant:Employee? + + var type:TaskType + + enum TaskType { + case Call + case Report + case Meet + case Support + + var typeTitle:String { + get { + let titleString:String + switch self { + case .Call: + titleString = "Call" + case .Report: + titleString = "Report" + case .Meet: + titleString = "Meet" + case .Support: + titleString = "Support" + } + } + } + } + } + +Call Method: type:Task.TaskType.Report + +### 인스턴스 초기화 +모든 stored property의 최초값 설정 + +Stored Property : 메모리를 차지하는 프라퍼티 + +Computed Property : 계산에 의해 값을 제공하는 프라퍼티 + + init (name:String, phone:String) { + self.init(name:name) + self.phoneNumber = phone + } + + + init (a:String, b:Tasks) { + + self.a = + self.b = + + } + + +## METHOD + +타입에 종속되어있는 함수 +인스턴스에서 필요한 작업이나 기능을 함수로 만들어놓은 것 +Class, Structure, Enumeration 모두 인스턴스 메소드를 가질 수 있음 + +## UI Table view + +UITableViewCell (Background view, Selected background view, Content view(Editing Control, Acessory View, Reordering control)) <= UIView + +## Function Type + +함수가 1등 시민 + +String, Double, Int - 기본 타입 + +Array, Dictionary, Set - 컬렉션 타입들 + +UIView, UILabel, UITableView - Cocoa Touch 클래스 타입들 + + () -> Void + (Int, Int) -> Int - 함수 타입들  /매개변수와 리턴값 + +Code from The Swift Programming Language + + func addTwoInts(a:Int, b:Int) -> Int + {return a + b} + func multiplyTwoInts(a:Int, b:Int) -> Int + {return a * b} + + var mathFunction: (Int, Int) -> Int = addTwoInts + mathFunction(2, 3) //=5 + mathFunction = multiplyTwoInts + mathFunction(2, 3) //=6 + +func 함수가 매개변수로도 들어갈 수 있다! + + func finalPrice(source:Double, additional:(Double) -> Double) -> Double { } + +## Closure + +1등 시민으로 사용가능한 독립적인 코드 조각 + + { (params) -> returnType in + statements + } + +in 이 나오면 클로져 + + let addVATClosure = { (source:Double) -> Double in + return source * 1.1 + } + + let priceX = addVATClosure(value) + +클로저의 축약 + + Lev1. let addVATClosure = { (source:Double) -> Double in + return source * 1.1 + } + + Lev2. let addVATClosure2 = { source in + return source * 1.1 + } + + Lev3. let addVATClosure3 = { source in + source * 1.1 + } + + Lev.4 let addVATClosure4 = {$0 * 1.1} + +- 매개변수 타입과 리턴타입은 추론 가능하므로 축약 가능 +- 리턴이라는 지시어도 당연히므로 축약 가능 +- 매개변수의 이름은 내부적으로 사용하는 것이므로 축약하고 위치로 참조 가능하므로 축약한다 + +## Curring + +함수를 리턴하는 함수 + +func makeAdder (x:Int) -> (Int) -> Int { + func adder(a:Int) -> Int { + return x + a + } + return adder + } + + let add5 = makeAdder(5) + + 함수내부의 변수를 조정할 수 있는 함수 + +## Map + + 배열의 항목에 함수를 적용하기 + + \[a, b, c, d, e\].map{f(x)} => \[f(a), f(b), f(c), f(d), f(e)\] + + let vatMapPrices = transactions_array.map({ transaction -> Double in + return transaction * 1.1 + }) + +## Filter + +조건문을 대체 가능 + +\[a, b, c, d, e\].filter{x>100} => 100보다 큰 항목들로 이루어진 배열 리턴 + +## Sort + +배열을 정렬 + +\[a, b, c, d, e\].sort{$0 > $1} + + func ascendantSort (sort1:Double, sort2:Double) -> Bool { + return sort1 > sort2 + } + + let sortedPrices = vatPrices.sort(accendantSort) + let sortedPrices2 = vatPrices.sort({ $0 > $1 }) + let sortedPrices3 = vatPrices.sort(>) + +## Reduce + +하나의 값으로 수렴 + +\[a, b, c, d, e\].reduce(초기값, combine:+) => 배열의 모든 값이 합한 값 + + func priceSum (base:Double, adder:Double) -> Double { + return base + adder + } + + var sum:Double = 0.0 + for price in vatPrices { + sum = priceSum(sum, adder:price) + } + +Reduce + + var sum2:Double = 0.0 + let sumReduce = vatPrices.reduce(sum2, combine: priceSum) + let sumReduce2 - vatPrices.reduce(0.0, combine: { base, adder in + base + adder + }) + + var sumReduce3 = vatPrices.reduce(0.0, combine: +) + +문자열도 가능 + let pricesInString = vatPrices.reduce("", combine: { $0 + "\($1)\n"}) + + +## Class, Method, Function + +Class - no round brackets, Function - round brackets, put within a class, + class Person { + + init(){ + print("New person initialized") + } + + func SayHello(){ + + print("Hello") + + } + } + + var person_1 = Person() + + person_1.SayHello() + + diff --git a/Converted by Andrew Noh/nohHaKyung_swift_completion.jpg b/Converted by Andrew Noh/nohHaKyung_swift_completion.jpg new file mode 100644 index 0000000..f7710d1 Binary files /dev/null and b/Converted by Andrew Noh/nohHaKyung_swift_completion.jpg differ diff --git a/SampleCodes/MeetingRooms/MeetingRooms.xcodeproj/project.pbxproj b/SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms.xcodeproj/project.pbxproj similarity index 100% rename from SampleCodes/MeetingRooms/MeetingRooms.xcodeproj/project.pbxproj rename to SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms.xcodeproj/project.pbxproj diff --git a/SampleCodes/MeetingRooms/MeetingRooms/AppDelegate.swift b/SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/AppDelegate.swift similarity index 100% rename from SampleCodes/MeetingRooms/MeetingRooms/AppDelegate.swift rename to SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/AppDelegate.swift diff --git a/SampleCodes/MeetingRooms/MeetingRooms/Assets.xcassets/4347286612_11577182f1_o.imageset/4347286612_11577182f1_o.jpg b/SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Assets.xcassets/4347286612_11577182f1_o.imageset/4347286612_11577182f1_o.jpg similarity index 100% rename from SampleCodes/MeetingRooms/MeetingRooms/Assets.xcassets/4347286612_11577182f1_o.imageset/4347286612_11577182f1_o.jpg rename to SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Assets.xcassets/4347286612_11577182f1_o.imageset/4347286612_11577182f1_o.jpg diff --git a/SampleCodes/MeetingRooms/MeetingRooms/Assets.xcassets/4347286612_11577182f1_o.imageset/Contents.json b/SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Assets.xcassets/4347286612_11577182f1_o.imageset/Contents.json similarity index 100% rename from SampleCodes/MeetingRooms/MeetingRooms/Assets.xcassets/4347286612_11577182f1_o.imageset/Contents.json rename to SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Assets.xcassets/4347286612_11577182f1_o.imageset/Contents.json diff --git a/SampleCodes/MeetingRooms/MeetingRooms/Assets.xcassets/AppIcon.appiconset/Contents.json b/SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from SampleCodes/MeetingRooms/MeetingRooms/Assets.xcassets/AppIcon.appiconset/Contents.json rename to SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/SampleCodes/MeetingRooms/MeetingRooms/Assets.xcassets/Contents.json b/SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Assets.xcassets/Contents.json similarity index 100% rename from SampleCodes/MeetingRooms/MeetingRooms/Assets.xcassets/Contents.json rename to SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Assets.xcassets/Contents.json diff --git a/SampleCodes/MeetingRooms/MeetingRooms/Base.lproj/LaunchScreen.storyboard b/SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from SampleCodes/MeetingRooms/MeetingRooms/Base.lproj/LaunchScreen.storyboard rename to SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Base.lproj/LaunchScreen.storyboard diff --git a/SampleCodes/MeetingRooms/MeetingRooms/Base.lproj/Main.storyboard b/SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Base.lproj/Main.storyboard similarity index 100% rename from SampleCodes/MeetingRooms/MeetingRooms/Base.lproj/Main.storyboard rename to SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Base.lproj/Main.storyboard diff --git a/SampleCodes/MeetingRooms/MeetingRooms/Info.plist b/SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Info.plist similarity index 100% rename from SampleCodes/MeetingRooms/MeetingRooms/Info.plist rename to SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/Info.plist diff --git a/SampleCodes/MeetingRooms/MeetingRooms/ViewController.swift b/SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/ViewController.swift similarity index 100% rename from SampleCodes/MeetingRooms/MeetingRooms/ViewController.swift rename to SampleCodes/Swift 2(old)/MeetingRooms/MeetingRooms/ViewController.swift diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic.xcodeproj/project.pbxproj b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic.xcodeproj/project.pbxproj similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic.xcodeproj/project.pbxproj rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic.xcodeproj/project.pbxproj diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/AppDelegate.swift b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/AppDelegate.swift similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/AppDelegate.swift rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/AppDelegate.swift diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/AppIcon.appiconset/Contents.json b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/AppIcon.appiconset/Contents.json rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/Contents.json b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/Contents.json similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/Contents.json rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/Contents.json diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/Contents.json b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/Contents.json similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/Contents.json rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/Contents.json diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/building_tab.png b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/building_tab.png similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/building_tab.png rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/building_tab.png diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/Contents.json b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/Contents.json similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/Contents.json rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/Contents.json diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/equipment_tab.png b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/equipment_tab.png similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/equipment_tab.png rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/equipment_tab.png diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/Contents.json b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/Contents.json similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/Contents.json rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/Contents.json diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/location.png b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/location.png similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/location.png rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/location.png diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/LaunchScreen.storyboard b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/LaunchScreen.storyboard rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/LaunchScreen.storyboard diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/Main.storyboard b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/Main.storyboard similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/Main.storyboard rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/Main.storyboard diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/BranchListViewController.swift b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/BranchListViewController.swift similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/BranchListViewController.swift rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/BranchListViewController.swift diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/DataCenter.swift b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/DataCenter.swift similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/DataCenter.swift rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/DataCenter.swift diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsDefault.plist b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsDefault.plist similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsDefault.plist rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsDefault.plist diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsListViewController.swift b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsListViewController.swift similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsListViewController.swift rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsListViewController.swift diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Info.plist b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Info.plist similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/Info.plist rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/Info.plist diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/MeetingRoomsListController.swift b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/MeetingRoomsListController.swift similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/MeetingRoomsListController.swift rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/MeetingRoomsListController.swift diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/ReservationListViewController.swift b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/ReservationListViewController.swift similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/ReservationListViewController.swift rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/ReservationListViewController.swift diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/ReserveRoomViewController.swift b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/ReserveRoomViewController.swift similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/ReserveRoomViewController.swift rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/ReserveRoomViewController.swift diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/RoomInfoViewController.swift b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/RoomInfoViewController.swift similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/RoomInfoViewController.swift rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/RoomInfoViewController.swift diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/ServiceListViewController.swift b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/ServiceListViewController.swift similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/ServiceListViewController.swift rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/ServiceListViewController.swift diff --git a/SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/TintColorViewController.swift b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/TintColorViewController.swift similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/MeetingRoomsDynamic/TintColorViewController.swift rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/MeetingRoomsDynamic/TintColorViewController.swift diff --git a/SampleCodes/MeetingRoomsDynamic/building.png b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/building.png similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/building.png rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/building.png diff --git a/SampleCodes/MeetingRoomsDynamic/equipment.png b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/equipment.png similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/equipment.png rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/equipment.png diff --git a/SampleCodes/MeetingRoomsDynamic/location.png b/SampleCodes/Swift 2(old)/MeetingRoomsDynamic/location.png similarity index 100% rename from SampleCodes/MeetingRoomsDynamic/location.png rename to SampleCodes/Swift 2(old)/MeetingRoomsDynamic/location.png diff --git a/SampleCodes/MoneyConverter/MoneyConverter.xcodeproj/project.pbxproj b/SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter.xcodeproj/project.pbxproj similarity index 100% rename from SampleCodes/MoneyConverter/MoneyConverter.xcodeproj/project.pbxproj rename to SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter.xcodeproj/project.pbxproj diff --git a/SampleCodes/MoneyConverter/MoneyConverter/AppDelegate.swift b/SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/AppDelegate.swift similarity index 100% rename from SampleCodes/MoneyConverter/MoneyConverter/AppDelegate.swift rename to SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/AppDelegate.swift diff --git a/SampleCodes/MoneyConverter/MoneyConverter/Assets.xcassets/AppIcon.appiconset/Contents.json b/SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from SampleCodes/MoneyConverter/MoneyConverter/Assets.xcassets/AppIcon.appiconset/Contents.json rename to SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/SampleCodes/MoneyConverter/MoneyConverter/Base.lproj/LaunchScreen.storyboard b/SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from SampleCodes/MoneyConverter/MoneyConverter/Base.lproj/LaunchScreen.storyboard rename to SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/Base.lproj/LaunchScreen.storyboard diff --git a/SampleCodes/MoneyConverter/MoneyConverter/Base.lproj/Main.storyboard b/SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/Base.lproj/Main.storyboard similarity index 100% rename from SampleCodes/MoneyConverter/MoneyConverter/Base.lproj/Main.storyboard rename to SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/Base.lproj/Main.storyboard diff --git a/SampleCodes/MoneyConverter/MoneyConverter/Info.plist b/SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/Info.plist similarity index 100% rename from SampleCodes/MoneyConverter/MoneyConverter/Info.plist rename to SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/Info.plist diff --git a/SampleCodes/MoneyConverter/MoneyConverter/Money.swift b/SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/Money.swift similarity index 100% rename from SampleCodes/MoneyConverter/MoneyConverter/Money.swift rename to SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/Money.swift diff --git a/SampleCodes/MoneyConverter/MoneyConverter/ViewController.swift b/SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/ViewController.swift similarity index 100% rename from SampleCodes/MoneyConverter/MoneyConverter/ViewController.swift rename to SampleCodes/Swift 2(old)/MoneyConverter/MoneyConverter/ViewController.swift diff --git a/SampleCodes/Swift 4/MeetingRooms/MeetingRooms.xcodeproj/project.pbxproj b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms.xcodeproj/project.pbxproj new file mode 100644 index 0000000..3f11a4b --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms.xcodeproj/project.pbxproj @@ -0,0 +1,327 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXBuildFile section */ + 9F9A896F1FAE18FC00AFEE0D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F9A896E1FAE18FC00AFEE0D /* AppDelegate.swift */; }; + 9F9A89711FAE18FC00AFEE0D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F9A89701FAE18FC00AFEE0D /* ViewController.swift */; }; + 9F9A89741FAE18FC00AFEE0D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F9A89721FAE18FC00AFEE0D /* Main.storyboard */; }; + 9F9A89761FAE18FC00AFEE0D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F9A89751FAE18FC00AFEE0D /* Assets.xcassets */; }; + 9F9A89791FAE18FC00AFEE0D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F9A89771FAE18FC00AFEE0D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 9F9A896B1FAE18FC00AFEE0D /* MeetingRooms.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MeetingRooms.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 9F9A896E1FAE18FC00AFEE0D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 9F9A89701FAE18FC00AFEE0D /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 9F9A89731FAE18FC00AFEE0D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 9F9A89751FAE18FC00AFEE0D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 9F9A89781FAE18FC00AFEE0D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 9F9A897A1FAE18FC00AFEE0D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9F9A89681FAE18FC00AFEE0D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9F9A89621FAE18FC00AFEE0D = { + isa = PBXGroup; + children = ( + 9F9A896D1FAE18FC00AFEE0D /* MeetingRooms */, + 9F9A896C1FAE18FC00AFEE0D /* Products */, + ); + sourceTree = ""; + }; + 9F9A896C1FAE18FC00AFEE0D /* Products */ = { + isa = PBXGroup; + children = ( + 9F9A896B1FAE18FC00AFEE0D /* MeetingRooms.app */, + ); + name = Products; + sourceTree = ""; + }; + 9F9A896D1FAE18FC00AFEE0D /* MeetingRooms */ = { + isa = PBXGroup; + children = ( + 9F9A896E1FAE18FC00AFEE0D /* AppDelegate.swift */, + 9F9A89701FAE18FC00AFEE0D /* ViewController.swift */, + 9F9A89721FAE18FC00AFEE0D /* Main.storyboard */, + 9F9A89751FAE18FC00AFEE0D /* Assets.xcassets */, + 9F9A89771FAE18FC00AFEE0D /* LaunchScreen.storyboard */, + 9F9A897A1FAE18FC00AFEE0D /* Info.plist */, + ); + path = MeetingRooms; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 9F9A896A1FAE18FC00AFEE0D /* MeetingRooms */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9F9A897D1FAE18FC00AFEE0D /* Build configuration list for PBXNativeTarget "MeetingRooms" */; + buildPhases = ( + 9F9A89671FAE18FC00AFEE0D /* Sources */, + 9F9A89681FAE18FC00AFEE0D /* Frameworks */, + 9F9A89691FAE18FC00AFEE0D /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MeetingRooms; + productName = MeetingRooms; + productReference = 9F9A896B1FAE18FC00AFEE0D /* MeetingRooms.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9F9A89631FAE18FC00AFEE0D /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0900; + LastUpgradeCheck = 0900; + ORGANIZATIONNAME = "Hakyung Noah"; + TargetAttributes = { + 9F9A896A1FAE18FC00AFEE0D = { + CreatedOnToolsVersion = 9.0; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 9F9A89661FAE18FC00AFEE0D /* Build configuration list for PBXProject "MeetingRooms" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 9F9A89621FAE18FC00AFEE0D; + productRefGroup = 9F9A896C1FAE18FC00AFEE0D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 9F9A896A1FAE18FC00AFEE0D /* MeetingRooms */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 9F9A89691FAE18FC00AFEE0D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9F9A89791FAE18FC00AFEE0D /* LaunchScreen.storyboard in Resources */, + 9F9A89761FAE18FC00AFEE0D /* Assets.xcassets in Resources */, + 9F9A89741FAE18FC00AFEE0D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 9F9A89671FAE18FC00AFEE0D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9F9A89711FAE18FC00AFEE0D /* ViewController.swift in Sources */, + 9F9A896F1FAE18FC00AFEE0D /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 9F9A89721FAE18FC00AFEE0D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9F9A89731FAE18FC00AFEE0D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 9F9A89771FAE18FC00AFEE0D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9F9A89781FAE18FC00AFEE0D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 9F9A897B1FAE18FC00AFEE0D /* 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_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_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 = 11.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 9F9A897C1FAE18FC00AFEE0D /* 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_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_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 = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 9F9A897E1FAE18FC00AFEE0D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = TZCQN9XXN6; + INFOPLIST_FILE = MeetingRooms/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.InterfaceProgramming2.www.MeetingRooms; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 9F9A897F1FAE18FC00AFEE0D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = TZCQN9XXN6; + INFOPLIST_FILE = MeetingRooms/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.InterfaceProgramming2.www.MeetingRooms; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 9F9A89661FAE18FC00AFEE0D /* Build configuration list for PBXProject "MeetingRooms" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9F9A897B1FAE18FC00AFEE0D /* Debug */, + 9F9A897C1FAE18FC00AFEE0D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9F9A897D1FAE18FC00AFEE0D /* Build configuration list for PBXNativeTarget "MeetingRooms" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9F9A897E1FAE18FC00AFEE0D /* Debug */, + 9F9A897F1FAE18FC00AFEE0D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9F9A89631FAE18FC00AFEE0D /* Project object */; +} diff --git a/SampleCodes/Swift 4/MeetingRooms/MeetingRooms.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..ff41f19 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/AppDelegate.swift b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/AppDelegate.swift new file mode 100644 index 0000000..e72f6f7 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// MeetingRooms +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Assets.xcassets/AppIcon.appiconset/Contents.json b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/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/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Assets.xcassets/Contents.json b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Assets.xcassets/image.imageset/Contents.json b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Assets.xcassets/image.imageset/Contents.json new file mode 100644 index 0000000..9cfcea8 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Assets.xcassets/image.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "image.jpg", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Assets.xcassets/image.imageset/image.jpg b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Assets.xcassets/image.imageset/image.jpg new file mode 100644 index 0000000..829e21b Binary files /dev/null and b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Assets.xcassets/image.imageset/image.jpg differ diff --git a/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Base.lproj/LaunchScreen.storyboard b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f83f6fd --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Base.lproj/Main.storyboard b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Base.lproj/Main.storyboard new file mode 100644 index 0000000..eb13229 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Base.lproj/Main.storyboard @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Info.plist b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/Info.plist new file mode 100644 index 0000000..16be3b6 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/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/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/ViewController.swift b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/ViewController.swift new file mode 100644 index 0000000..ac368f3 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRooms/MeetingRooms/ViewController.swift @@ -0,0 +1,25 @@ +// +// ViewController.swift +// MeetingRooms +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + +} + diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic.xcodeproj/project.pbxproj b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic.xcodeproj/project.pbxproj new file mode 100644 index 0000000..a77161b --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic.xcodeproj/project.pbxproj @@ -0,0 +1,367 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXBuildFile section */ + 9F55A1851FAE345D00AC560C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F55A1841FAE345D00AC560C /* AppDelegate.swift */; }; + 9F55A1871FAE345D00AC560C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F55A1861FAE345D00AC560C /* ViewController.swift */; }; + 9F55A18A1FAE345D00AC560C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F55A1881FAE345D00AC560C /* Main.storyboard */; }; + 9F55A18C1FAE345D00AC560C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F55A18B1FAE345D00AC560C /* Assets.xcassets */; }; + 9F55A18F1FAE345D00AC560C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F55A18D1FAE345D00AC560C /* LaunchScreen.storyboard */; }; + 9FE7D5ED1FAE5F2300B38429 /* EquipmentsDefault.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9FE7D5EC1FAE5F2300B38429 /* EquipmentsDefault.plist */; }; + 9FE7D5EF1FAE5F8500B38429 /* DataCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE7D5EE1FAE5F8500B38429 /* DataCenter.swift */; }; + 9FE7D5F11FAE6B6400B38429 /* RoomInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE7D5F01FAE6B6400B38429 /* RoomInfoViewController.swift */; }; + 9FE7D5F31FAE74E900B38429 /* BranchListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE7D5F21FAE74E900B38429 /* BranchListViewController.swift */; }; + 9FE7D5F51FAE750500B38429 /* EquipmentsListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE7D5F41FAE750500B38429 /* EquipmentsListViewController.swift */; }; + 9FE7D5F71FAE751700B38429 /* MeetingRoomsListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE7D5F61FAE751700B38429 /* MeetingRoomsListController.swift */; }; + 9FE7D5F91FAE752B00B38429 /* ReservationListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE7D5F81FAE752B00B38429 /* ReservationListViewController.swift */; }; + 9FE7D5FB1FAE754100B38429 /* ReserveRoomViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE7D5FA1FAE754100B38429 /* ReserveRoomViewController.swift */; }; + 9FE7D5FD1FAE755800B38429 /* ServiceListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE7D5FC1FAE755800B38429 /* ServiceListViewController.swift */; }; + 9FE7D5FF1FAE758C00B38429 /* TintColorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE7D5FE1FAE758C00B38429 /* TintColorViewController.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 9F55A1811FAE345D00AC560C /* MeetingRoomsDynamic.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MeetingRoomsDynamic.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 9F55A1841FAE345D00AC560C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 9F55A1861FAE345D00AC560C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 9F55A1891FAE345D00AC560C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 9F55A18B1FAE345D00AC560C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 9F55A18E1FAE345D00AC560C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 9F55A1901FAE345D00AC560C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9FE7D5EC1FAE5F2300B38429 /* EquipmentsDefault.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = EquipmentsDefault.plist; sourceTree = ""; }; + 9FE7D5EE1FAE5F8500B38429 /* DataCenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataCenter.swift; sourceTree = ""; }; + 9FE7D5F01FAE6B6400B38429 /* RoomInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomInfoViewController.swift; sourceTree = ""; }; + 9FE7D5F21FAE74E900B38429 /* BranchListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BranchListViewController.swift; sourceTree = ""; }; + 9FE7D5F41FAE750500B38429 /* EquipmentsListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EquipmentsListViewController.swift; sourceTree = ""; }; + 9FE7D5F61FAE751700B38429 /* MeetingRoomsListController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingRoomsListController.swift; sourceTree = ""; }; + 9FE7D5F81FAE752B00B38429 /* ReservationListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReservationListViewController.swift; sourceTree = ""; }; + 9FE7D5FA1FAE754100B38429 /* ReserveRoomViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReserveRoomViewController.swift; sourceTree = ""; }; + 9FE7D5FC1FAE755800B38429 /* ServiceListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceListViewController.swift; sourceTree = ""; }; + 9FE7D5FE1FAE758C00B38429 /* TintColorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TintColorViewController.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9F55A17E1FAE345D00AC560C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9F55A1781FAE345D00AC560C = { + isa = PBXGroup; + children = ( + 9F55A1831FAE345D00AC560C /* MeetingRoomsDynamic */, + 9F55A1821FAE345D00AC560C /* Products */, + ); + sourceTree = ""; + }; + 9F55A1821FAE345D00AC560C /* Products */ = { + isa = PBXGroup; + children = ( + 9F55A1811FAE345D00AC560C /* MeetingRoomsDynamic.app */, + ); + name = Products; + sourceTree = ""; + }; + 9F55A1831FAE345D00AC560C /* MeetingRoomsDynamic */ = { + isa = PBXGroup; + children = ( + 9F55A1841FAE345D00AC560C /* AppDelegate.swift */, + 9FE7D5EE1FAE5F8500B38429 /* DataCenter.swift */, + 9F55A1861FAE345D00AC560C /* ViewController.swift */, + 9FE7D5FE1FAE758C00B38429 /* TintColorViewController.swift */, + 9FE7D5F01FAE6B6400B38429 /* RoomInfoViewController.swift */, + 9FE7D5F21FAE74E900B38429 /* BranchListViewController.swift */, + 9FE7D5FC1FAE755800B38429 /* ServiceListViewController.swift */, + 9FE7D5F61FAE751700B38429 /* MeetingRoomsListController.swift */, + 9FE7D5F81FAE752B00B38429 /* ReservationListViewController.swift */, + 9FE7D5FA1FAE754100B38429 /* ReserveRoomViewController.swift */, + 9FE7D5F41FAE750500B38429 /* EquipmentsListViewController.swift */, + 9F55A1881FAE345D00AC560C /* Main.storyboard */, + 9F55A18B1FAE345D00AC560C /* Assets.xcassets */, + 9F55A18D1FAE345D00AC560C /* LaunchScreen.storyboard */, + 9FE7D5EC1FAE5F2300B38429 /* EquipmentsDefault.plist */, + 9F55A1901FAE345D00AC560C /* Info.plist */, + ); + path = MeetingRoomsDynamic; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 9F55A1801FAE345D00AC560C /* MeetingRoomsDynamic */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9F55A1931FAE345D00AC560C /* Build configuration list for PBXNativeTarget "MeetingRoomsDynamic" */; + buildPhases = ( + 9F55A17D1FAE345D00AC560C /* Sources */, + 9F55A17E1FAE345D00AC560C /* Frameworks */, + 9F55A17F1FAE345D00AC560C /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MeetingRoomsDynamic; + productName = MeetingRoomsDynamic; + productReference = 9F55A1811FAE345D00AC560C /* MeetingRoomsDynamic.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9F55A1791FAE345D00AC560C /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0900; + LastUpgradeCheck = 0900; + ORGANIZATIONNAME = "Hakyung Noah"; + TargetAttributes = { + 9F55A1801FAE345D00AC560C = { + CreatedOnToolsVersion = 9.0; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 9F55A17C1FAE345D00AC560C /* Build configuration list for PBXProject "MeetingRoomsDynamic" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 9F55A1781FAE345D00AC560C; + productRefGroup = 9F55A1821FAE345D00AC560C /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 9F55A1801FAE345D00AC560C /* MeetingRoomsDynamic */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 9F55A17F1FAE345D00AC560C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9F55A18F1FAE345D00AC560C /* LaunchScreen.storyboard in Resources */, + 9FE7D5ED1FAE5F2300B38429 /* EquipmentsDefault.plist in Resources */, + 9F55A18C1FAE345D00AC560C /* Assets.xcassets in Resources */, + 9F55A18A1FAE345D00AC560C /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 9F55A17D1FAE345D00AC560C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9FE7D5FD1FAE755800B38429 /* ServiceListViewController.swift in Sources */, + 9FE7D5EF1FAE5F8500B38429 /* DataCenter.swift in Sources */, + 9F55A1871FAE345D00AC560C /* ViewController.swift in Sources */, + 9F55A1851FAE345D00AC560C /* AppDelegate.swift in Sources */, + 9FE7D5FF1FAE758C00B38429 /* TintColorViewController.swift in Sources */, + 9FE7D5F91FAE752B00B38429 /* ReservationListViewController.swift in Sources */, + 9FE7D5F31FAE74E900B38429 /* BranchListViewController.swift in Sources */, + 9FE7D5F11FAE6B6400B38429 /* RoomInfoViewController.swift in Sources */, + 9FE7D5F51FAE750500B38429 /* EquipmentsListViewController.swift in Sources */, + 9FE7D5F71FAE751700B38429 /* MeetingRoomsListController.swift in Sources */, + 9FE7D5FB1FAE754100B38429 /* ReserveRoomViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 9F55A1881FAE345D00AC560C /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9F55A1891FAE345D00AC560C /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 9F55A18D1FAE345D00AC560C /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9F55A18E1FAE345D00AC560C /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 9F55A1911FAE345D00AC560C /* 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_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_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 = 11.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 9F55A1921FAE345D00AC560C /* 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_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_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 = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 9F55A1941FAE345D00AC560C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = TZCQN9XXN6; + INFOPLIST_FILE = MeetingRoomsDynamic/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.InterfaceProgramming2.www.MeetingRoomsDynamic; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 9F55A1951FAE345D00AC560C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = TZCQN9XXN6; + INFOPLIST_FILE = MeetingRoomsDynamic/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.InterfaceProgramming2.www.MeetingRoomsDynamic; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 9F55A17C1FAE345D00AC560C /* Build configuration list for PBXProject "MeetingRoomsDynamic" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9F55A1911FAE345D00AC560C /* Debug */, + 9F55A1921FAE345D00AC560C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9F55A1931FAE345D00AC560C /* Build configuration list for PBXNativeTarget "MeetingRoomsDynamic" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9F55A1941FAE345D00AC560C /* Debug */, + 9F55A1951FAE345D00AC560C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9F55A1791FAE345D00AC560C /* Project object */; +} diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..c52d61b --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/AppDelegate.swift b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/AppDelegate.swift new file mode 100644 index 0000000..9edbd3e --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/AppDelegate.swift @@ -0,0 +1,57 @@ +// +// AppDelegate.swift +// MeetingRoomsDynamic +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + + dataCenter.save() + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + + + let userDefaultColor = UserDefaults.standard.integer(forKey: TintColorKey) + guard let defaultColor = TintColor(rawValue: userDefaultColor)?.color else { + return + } + applyTintColor(defaultColor) + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + + dataCenter.save() + } + + +} + diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/AppIcon.appiconset/Contents.json b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/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/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/Contents.json b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/Contents.json b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/Contents.json new file mode 100644 index 0000000..bf9fa3c --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "building_tab.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/building_tab.png b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/building_tab.png new file mode 100644 index 0000000..b8bb3f1 Binary files /dev/null and b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/building_tab.imageset/building_tab.png differ diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/Contents.json b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/Contents.json new file mode 100644 index 0000000..31ee980 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "equipment_tab.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/equipment_tab.png b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/equipment_tab.png new file mode 100644 index 0000000..a5ae185 Binary files /dev/null and b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/equipment_tab.imageset/equipment_tab.png differ diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/Contents.json b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/Contents.json new file mode 100644 index 0000000..73c4fdb --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "location.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/location.png b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/location.png new file mode 100644 index 0000000..064332f Binary files /dev/null and b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Assets.xcassets/location.imageset/location.png differ diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/LaunchScreen.storyboard b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f83f6fd --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/Main.storyboard b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/Main.storyboard new file mode 100644 index 0000000..34601fa --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Base.lproj/Main.storyboard @@ -0,0 +1,806 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/BranchListViewController.swift b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/BranchListViewController.swift new file mode 100644 index 0000000..78ca717 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/BranchListViewController.swift @@ -0,0 +1,129 @@ +// +// BranchListViewController.swift +// MeetingRoomsDynamic +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +class BranchListViewController: UITableViewController { + + override func viewDidLoad() { +// super.viewDidLoad() + self.title = "지점" + + } +/* + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + } +*/ + + // MARK: - Table view data source + + override func numberOfSections(in tableView: UITableView) -> Int { + + return 1 + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of rows + let rowCount = dataCenter.branches.count + return rowCount + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "BranchCell", for: indexPath) + + // Configure the cell... + let branch = dataCenter.branches[indexPath.row] + cell.textLabel?.text = branch.name + return cell + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if segue.identifier == "ServiceSegue" { + guard let destination = segue.destination as? ServiceListViewController, let selectedIndex = self.tableView.indexPathForSelectedRow?.row else { + return + } + destination.branch = dataCenter.branches[selectedIndex] as Branch + } + } + + @IBAction func locationTurnOn(_ sender: Any) { + let locationAlert = UIAlertController(title: "위치 정보 요청", message: "위치 정보를 기반으로 가까운 지점을 자동으로 선택할 수 있습니다. 또는 지도앱에서 지점의 위치 정보를 제공해 드립니다. 선택하신 기능이 계속 제공됩니다. 환경설정에서 제공되는 기능을 변경할 수 있습니다.", preferredStyle: .actionSheet) + let locationAction = UIAlertAction(title: "위치정보 켜기", style: .default, handler: { (action:UIAlertAction) -> Void in + print ("위치정보 켜기 선택") + }) + let openMapAction = UIAlertAction(title: "지도앱에서 열기", style: .default, handler: { (action:UIAlertAction) -> Void in + print ("지도앱에서 열기 선택") + }) + + locationAlert.addAction(locationAction) + locationAlert.addAction(openMapAction) + self.present(locationAlert, animated: true, completion: nil) + } + + + + /* + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { + if segue.identifier == "ServiceSegue" { + if let destination = segue.destinationViewController as? ServiceListViewController { + if let selectedIndex = self.tableView.indexPathForSelectedRow?.row { + destination.branch = dataCenter.branches[selectedIndex] as Branch + } + + } + } + } + */ + + /* + // 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: UITableViewCellEditingStyle, 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.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/DataCenter.swift b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/DataCenter.swift new file mode 100644 index 0000000..6291bf7 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/DataCenter.swift @@ -0,0 +1,164 @@ +// +// DataCenter.swift +// MeetingRoomsDynamic +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import Foundation + +let dataCenter:DataCenter = DataCenter() +let fileName = "BranchData.brch" + +class DataCenter { + var branches:[Branch] = [] + + var filePath:String { get{ + let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first! + return documentDirectory + fileName + }} + + init() { + if FileManager.default.fileExists(atPath: self.filePath) { + //read + if let unarchArray = NSKeyedUnarchiver.unarchiveObject(withFile: self.filePath) as? [Branch] { + branches += unarchArray + } + } else { + //create + branches += defaultData() + } + + + } + + func defaultData() -> Array { + let banksyRoom = MeetingRoom(name: "Banksy", capacity: 4) + let kahloRoom = MeetingRoom(name: "Kahlo", capacity: 8) + let riveraRoom = MeetingRoom(name: "Rivera", capacity: 8) + let picassoRoom = MeetingRoom(name: "Picasso", capacity: 10) + + + let vehicleService = Service(name: "차량예약") + let meetingRoomService = Service(name: "회의실예약") + let visitorService = Service(name: "방문자예약") + let deskService = Service(name: "데스크예약") + meetingRoomService.item = [banksyRoom, kahloRoom, riveraRoom, picassoRoom] + + let pangyoBranch = Branch(name: "판교점") + let samsungBranch = Branch(name: "삼성점") + let yeoksamBranch = Branch(name: "역삼점") + let sinrimBranch = Branch(name: "신림점") + let songdoBranch = Branch(name: "송도점") + let anamBranch = Branch(name: "안암점") + pangyoBranch.services = [vehicleService, meetingRoomService, visitorService, deskService] + + let branchArray = [samsungBranch, pangyoBranch, yeoksamBranch, sinrimBranch, songdoBranch, anamBranch] + return branchArray + } + + func save(){ + NSKeyedArchiver.archiveRootObject(self.branches, toFile: self.filePath) + } +} + + +class Branch:NSObject, NSCoding { + let name:String + var services:[Service]? + + init(name:String) { + self.name = name + } + + required init?(coder aDecoder: NSCoder) { + self.name = aDecoder.decodeObject(forKey: "name") as! String + self.services = aDecoder.decodeObject(forKey: "services") as? [Service] + } + + func encode(with aCoder: NSCoder) { + aCoder.encode(self.name, forKey: "name") + aCoder.encode(self.services, forKey: "services") + } +} + + +class Service:NSObject, NSCoding { + let name:String + var item:[MeetingRoom]? + + init (name:String){ + self.name = name + } + + required init?(coder aDecoder: NSCoder) { + self.name = aDecoder.decodeObject(forKey: "name") as! String + self.item = aDecoder.decodeObject(forKey: "item") as? [MeetingRoom] + } + + func encode(with aCoder: NSCoder) { + aCoder.encode(self.name, forKey: "name") + aCoder.encode(self.item, forKey: "item") + } + +} + + +class MeetingRoom:NSObject, NSCoding { + let name:String + let capacity:Int + var reservations:[Reservation]? + + init(name:String, capacity:Int) { + self.name = name + self.capacity = capacity + } + + required init?(coder aDecoder: NSCoder) { + self.name = aDecoder.decodeObject(forKey: "name") as! String + self.capacity = aDecoder.decodeInteger(forKey: "capacity") + self.reservations = aDecoder.decodeObject(forKey: "reservations") as? [Reservation] + } + + func encode(with aCoder: NSCoder) { + aCoder.encode(self.name, forKey: "name") + aCoder.encode(self.capacity, forKey: "capacity") + aCoder.encode(self.reservations, forKey: "reservations") + } +} + + + +class Reservation:NSObject, NSCoding { + var hostName:String + var date:Date + var attendees:Int + var equipments:[String] + var catering:Bool + + override init() { + self.hostName = "Host of meeting" + self.date = Date() + self.attendees = 1 + self.equipments = [] + self.catering = false + } + + + required init?(coder aDecoder: NSCoder) { + self.hostName = aDecoder.decodeObject(forKey: "hostName") as! String + self.date = aDecoder.decodeObject(forKey: "date") as! Date + self.attendees = aDecoder.decodeInteger(forKey: "attendees") + self.equipments = aDecoder.decodeObject(forKey: "equipments") as! [String] + self.catering = aDecoder.decodeBool(forKey: "catering") + } + + func encode(with aCoder: NSCoder) { + aCoder.encode(self.hostName, forKey: "hostName") + aCoder.encode(self.date, forKey: "date") + aCoder.encode(self.attendees, forKey: "attendees") + aCoder.encode(self.equipments, forKey: "equipments") + aCoder.encode(self.catering, forKey: "catering") + } +} diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsDefault.plist b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsDefault.plist new file mode 100644 index 0000000..5962ab0 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsDefault.plist @@ -0,0 +1,30 @@ + + + + + + name + HP G2020T + amount + 15 + + + name + Lenovo P900TW + amount + 10 + + + name + HP DL320e + amount + 7 + + + name + TYAN KST208 + amount + 20 + + + diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsListViewController.swift b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsListViewController.swift new file mode 100644 index 0000000..8d61e80 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/EquipmentsListViewController.swift @@ -0,0 +1,115 @@ +// +// EquipmentsListViewController.swift +// MeetingRoomsDynamic +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +let EquipmentFileName = "EquipmentsDefault" + +class EquipmentsListViewController: UITableViewController { + + var equipments:Array = [] + + override func viewDidLoad() { + + super.viewDidLoad() + + guard let equipmentURL = Bundle.main.url(forResource: EquipmentFileName, withExtension: "plist") else { + print("No File") + return + } + if let equipmentsArray = NSArray(contentsOf: equipmentURL){ + //print(equipmentsArray) + equipments = equipments + Array(equipmentsArray) + } + + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + // MARK: - Table view data source + + override func numberOfSections(in tableView: UITableView) -> Int { + // #warning Incomplete implementation, return the number of sections + return 1 + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of rows + return equipments.count + } + + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "EquipmentCell", for: indexPath) + + // Configure the cell... + guard let equipment = equipments[indexPath.row] as? [String:AnyObject] else { + return cell + } + + if let name = equipment["name"] as? String { + cell.textLabel?.text = name + } + if let amount = equipment["amount"] as? Int { + cell.detailTextLabel?.text = String(amount) + } + + 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: UITableViewCellEditingStyle, 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.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Info.plist b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/Info.plist new file mode 100644 index 0000000..16be3b6 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/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/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/MeetingRoomsListController.swift b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/MeetingRoomsListController.swift new file mode 100644 index 0000000..47459a0 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/MeetingRoomsListController.swift @@ -0,0 +1,102 @@ +// +// MeetingRoomsListController.swift +// MeetingRoomsDynamic +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +class MeetingRoomsListController: UITableViewController { + + var service:Service? + + override func viewDidLoad() { + self.title = service?.name + } + + + override func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } + + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + guard let rowCount = service?.item?.count else { + return 0 + } + return rowCount + } + + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "ItemCell", for: indexPath) + + // Configure the cell... + guard let meetingRoom = service?.item?[indexPath.row] else { + return cell + } + cell.textLabel?.text = meetingRoom.name + cell.detailTextLabel?.text = String(meetingRoom.capacity) + return cell + + } + + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if segue.identifier == "ReservationSegue" { + guard let destination = segue.destination as? ReservationListViewController, let selectedIndex = self.tableView.indexPathForSelectedRow?.row, let meetingRoom = service?.item?[selectedIndex] else { + return + } + destination.meetingRoom = meetingRoom + } + } + + + /* + // 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: UITableViewCellEditingStyle, 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.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/ReservationListViewController.swift b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/ReservationListViewController.swift new file mode 100644 index 0000000..84ea267 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/ReservationListViewController.swift @@ -0,0 +1,111 @@ +// +// ReservationListViewController.swift +// MeetingRoomsDynamic +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +class ReservationListViewController: UITableViewController { + + var meetingRoom:MeetingRoom? + var newReservation:Reservation? + + override func viewDidLoad() { + super.viewDidLoad() + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + } + + func addNewItem(_ reservation:Reservation) { + if (self.meetingRoom?.reservations?.append(reservation)) == nil { + self.meetingRoom?.reservations = [reservation] + } + dataCenter.save() + + self.tableView.reloadData() + + } + + @IBAction func unwindToReserveList(_ segue:UIStoryboardSegue) { + print("unwind") + } + + + // MARK: - Table view data source + + override func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + guard let rowCount = meetingRoom?.reservations?.count else { + return 0 + } + return rowCount + } + + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "ReservationCell", for: indexPath) + + guard let reservation = meetingRoom?.reservations?[indexPath.row] else { + return cell + } + cell.textLabel?.text = reservation.date.description + cell.detailTextLabel?.text = reservation.hostName + 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: UITableViewCellEditingStyle, 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.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/ReserveRoomViewController.swift b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/ReserveRoomViewController.swift new file mode 100644 index 0000000..b9f25ae --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/ReserveRoomViewController.swift @@ -0,0 +1,156 @@ +// +// ReserveRoomViewController.swift +// MeetingRoomsDynamic +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +class ReserveRoomViewController: UITableViewController { + + @IBOutlet var hostNameField: UITextField! + @IBOutlet var datePicker: UIDatePicker! + @IBOutlet var attendeesField: UITextField! + @IBOutlet var equipmentsField: UITextField! + @IBOutlet var cateringSwitch: UISwitch! + + + override func viewDidLoad() { + super.viewDidLoad() + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + } + + + @IBAction func makeReservation(_ sender: Any) { + guard let reservation = makeReservation() else { + self.dismiss(animated: true, completion: { + }) + return + } + + switch self.presentingViewController { + case let tabBarC as UITabBarController: + if let navigationC = tabBarC.selectedViewController as? UINavigationController, let reservationListVC = navigationC.topViewController as? ReservationListViewController { + reservationListVC.addNewItem(reservation) + } + case let navigationC as UINavigationController: + if let reservationListVC = navigationC.topViewController as? ReservationListViewController { + reservationListVC.addNewItem(reservation) + } + case let reservationListVC as ReservationListViewController: + reservationListVC.addNewItem(reservation) + default: + print("Cannot find ReservationListViewController") + break + } + + self.dismiss(animated: true, completion: { + }) + } + + + @IBAction func cancelReservation(_ sender: Any) { + self.dismiss(animated: true, completion: nil) + } + + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if segue.identifier == "ReserveDone" { + guard let newReservation = makeReservation(), let reservationListVC = segue.destination as? ReservationListViewController else { + return + } + reservationListVC.addNewItem(newReservation) + } + } + + func makeReservation() -> Reservation? { + let newReservation = Reservation() + let host = hostNameField.text! + if host.isEmpty { + return nil + } + newReservation.hostName = host + newReservation.date = datePicker.date + if let equipmentArray = equipmentsField.text?.characters.split(separator: ",").map(String.init) { + newReservation.equipments = equipmentArray + } + newReservation.catering = cateringSwitch.isOn + return newReservation + } + + // MARK: - Table view data source + /* + override func numberOfSections(in tableView: UITableView) -> Int { + // #warning Incomplete implementation, return the number of sections + return 0 + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of rows + return 0 + } + */ + + + + /* + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath) + + // Configure the cell... + + 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: UITableViewCellEditingStyle, 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.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/RoomInfoViewController.swift b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/RoomInfoViewController.swift new file mode 100644 index 0000000..70e839d --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/RoomInfoViewController.swift @@ -0,0 +1,28 @@ +// +// RoomInfoViewController.swift +// MeetingRoomsDynamic +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +class RoomInfoViewController: UITableViewController { + + override func viewDidLoad() { + super.viewDidLoad() + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + + @IBAction func modalDismiss(_ sender: Any) { + self.dismiss(animated: true, completion: nil) + } + + +} diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/ServiceListViewController.swift b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/ServiceListViewController.swift new file mode 100644 index 0000000..eaf54e3 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/ServiceListViewController.swift @@ -0,0 +1,96 @@ +// +// ServiceListViewController.swift +// MeetingRoomsDynamic +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +class ServiceListViewController: UITableViewController { + + var branch:Branch? + + override func viewDidLoad() { + self.title = branch?.name + } + + override func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + guard let rowCount = branch?.services?.count else { + return 0 + } + return rowCount + } + + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "ServiceCell", for: indexPath) + + guard let service = branch?.services?[indexPath.row] else { + return cell + } + cell.textLabel?.text = service.name + + return cell + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if segue.identifier == "MeetingRoomSegue" { + guard let destination = segue.destination as? MeetingRoomsListController, let selectedIndex = self.tableView.indexPathForSelectedRow?.row , let service = branch?.services?[selectedIndex] else { + return + } + destination.service = service + } + } + + /* + // 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: UITableViewCellEditingStyle, 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.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/TintColorViewController.swift b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/TintColorViewController.swift new file mode 100644 index 0000000..f399af9 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/TintColorViewController.swift @@ -0,0 +1,76 @@ +// +// TintColorViewController.swift +// MeetingRoomsDynamic +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +enum TintColor:Int { + case blue=0, red, green, purple + + var color:UIColor {get{ + switch self { + case .blue: + return UIColor.blue + case .red: + return UIColor.red + case .green: + return UIColor.green + case .purple: + return UIColor.purple + } + }} +} +let TintColorKey = "TintColor" + + +func applyTintColor(_ color:UIColor){ + guard let window = UIApplication.shared.keyWindow else { + return + } + window.tintColor = color +} + + +class TintColorViewController: UIViewController { + + @IBOutlet var tintColorSegment: UISegmentedControl! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + let userDefaultColor = UserDefaults.standard.integer(forKey: TintColorKey) + + self.tintColorSegment.selectedSegmentIndex = userDefaultColor + + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + @IBAction func tintColorChanged(_ sender: Any) { + let selectedIndex = self.tintColorSegment.selectedSegmentIndex + UserDefaults.standard.set(selectedIndex, forKey: TintColorKey) + guard let changedColor = TintColor(rawValue: selectedIndex)?.color else { + return + } + applyTintColor(changedColor) + } + + /* + // 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.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/ViewController.swift b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/ViewController.swift new file mode 100644 index 0000000..9d201a0 --- /dev/null +++ b/SampleCodes/Swift 4/MeetingRoomsDynamic/MeetingRoomsDynamic/ViewController.swift @@ -0,0 +1,25 @@ +// +// ViewController.swift +// MeetingRoomsDynamic +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + +} + diff --git a/SampleCodes/Swift 4/MoneyConverter/MoneyConverter.xcodeproj/project.pbxproj b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter.xcodeproj/project.pbxproj new file mode 100644 index 0000000..330c2fe --- /dev/null +++ b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter.xcodeproj/project.pbxproj @@ -0,0 +1,331 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXBuildFile section */ + 9F01748C1FAE4B1F00F5006B /* Money.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F01748B1FAE4B1F00F5006B /* Money.swift */; }; + 9FBA3A011FAE36230007E1D3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FBA3A001FAE36230007E1D3 /* AppDelegate.swift */; }; + 9FBA3A031FAE36230007E1D3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FBA3A021FAE36230007E1D3 /* ViewController.swift */; }; + 9FBA3A061FAE36230007E1D3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FBA3A041FAE36230007E1D3 /* Main.storyboard */; }; + 9FBA3A081FAE36230007E1D3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9FBA3A071FAE36230007E1D3 /* Assets.xcassets */; }; + 9FBA3A0B1FAE36230007E1D3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FBA3A091FAE36230007E1D3 /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 9F01748B1FAE4B1F00F5006B /* Money.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Money.swift; sourceTree = ""; }; + 9FBA39FD1FAE36230007E1D3 /* MoneyConverter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MoneyConverter.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 9FBA3A001FAE36230007E1D3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 9FBA3A021FAE36230007E1D3 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 9FBA3A051FAE36230007E1D3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 9FBA3A071FAE36230007E1D3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 9FBA3A0A1FAE36230007E1D3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 9FBA3A0C1FAE36230007E1D3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9FBA39FA1FAE36230007E1D3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9FBA39F41FAE36230007E1D3 = { + isa = PBXGroup; + children = ( + 9FBA39FF1FAE36230007E1D3 /* MoneyConverter */, + 9FBA39FE1FAE36230007E1D3 /* Products */, + ); + sourceTree = ""; + }; + 9FBA39FE1FAE36230007E1D3 /* Products */ = { + isa = PBXGroup; + children = ( + 9FBA39FD1FAE36230007E1D3 /* MoneyConverter.app */, + ); + name = Products; + sourceTree = ""; + }; + 9FBA39FF1FAE36230007E1D3 /* MoneyConverter */ = { + isa = PBXGroup; + children = ( + 9FBA3A001FAE36230007E1D3 /* AppDelegate.swift */, + 9FBA3A021FAE36230007E1D3 /* ViewController.swift */, + 9FBA3A041FAE36230007E1D3 /* Main.storyboard */, + 9F01748B1FAE4B1F00F5006B /* Money.swift */, + 9FBA3A071FAE36230007E1D3 /* Assets.xcassets */, + 9FBA3A091FAE36230007E1D3 /* LaunchScreen.storyboard */, + 9FBA3A0C1FAE36230007E1D3 /* Info.plist */, + ); + path = MoneyConverter; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 9FBA39FC1FAE36230007E1D3 /* MoneyConverter */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9FBA3A0F1FAE36240007E1D3 /* Build configuration list for PBXNativeTarget "MoneyConverter" */; + buildPhases = ( + 9FBA39F91FAE36230007E1D3 /* Sources */, + 9FBA39FA1FAE36230007E1D3 /* Frameworks */, + 9FBA39FB1FAE36230007E1D3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MoneyConverter; + productName = MoneyConverter; + productReference = 9FBA39FD1FAE36230007E1D3 /* MoneyConverter.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9FBA39F51FAE36230007E1D3 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0900; + LastUpgradeCheck = 0900; + ORGANIZATIONNAME = "Hakyung Noah"; + TargetAttributes = { + 9FBA39FC1FAE36230007E1D3 = { + CreatedOnToolsVersion = 9.0; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 9FBA39F81FAE36230007E1D3 /* Build configuration list for PBXProject "MoneyConverter" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 9FBA39F41FAE36230007E1D3; + productRefGroup = 9FBA39FE1FAE36230007E1D3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 9FBA39FC1FAE36230007E1D3 /* MoneyConverter */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 9FBA39FB1FAE36230007E1D3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9FBA3A0B1FAE36230007E1D3 /* LaunchScreen.storyboard in Resources */, + 9FBA3A081FAE36230007E1D3 /* Assets.xcassets in Resources */, + 9FBA3A061FAE36230007E1D3 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 9FBA39F91FAE36230007E1D3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9F01748C1FAE4B1F00F5006B /* Money.swift in Sources */, + 9FBA3A031FAE36230007E1D3 /* ViewController.swift in Sources */, + 9FBA3A011FAE36230007E1D3 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 9FBA3A041FAE36230007E1D3 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9FBA3A051FAE36230007E1D3 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 9FBA3A091FAE36230007E1D3 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9FBA3A0A1FAE36230007E1D3 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 9FBA3A0D1FAE36240007E1D3 /* 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_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_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 = 11.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 9FBA3A0E1FAE36240007E1D3 /* 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_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = 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_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 = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 9FBA3A101FAE36240007E1D3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = TZCQN9XXN6; + INFOPLIST_FILE = MoneyConverter/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.InterfaceProgramming2.www.MoneyConverter; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 9FBA3A111FAE36240007E1D3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = TZCQN9XXN6; + INFOPLIST_FILE = MoneyConverter/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.InterfaceProgramming2.www.MoneyConverter; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 9FBA39F81FAE36230007E1D3 /* Build configuration list for PBXProject "MoneyConverter" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9FBA3A0D1FAE36240007E1D3 /* Debug */, + 9FBA3A0E1FAE36240007E1D3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9FBA3A0F1FAE36240007E1D3 /* Build configuration list for PBXNativeTarget "MoneyConverter" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9FBA3A101FAE36240007E1D3 /* Debug */, + 9FBA3A111FAE36240007E1D3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9FBA39F51FAE36230007E1D3 /* Project object */; +} diff --git a/SampleCodes/Swift 4/MoneyConverter/MoneyConverter.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..5566428 --- /dev/null +++ b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/AppDelegate.swift b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/AppDelegate.swift new file mode 100644 index 0000000..022b8ef --- /dev/null +++ b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// MoneyConverter +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Assets.xcassets/AppIcon.appiconset/Contents.json b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..1d060ed --- /dev/null +++ b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,93 @@ +{ + "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" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Base.lproj/LaunchScreen.storyboard b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f83f6fd --- /dev/null +++ b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Base.lproj/Main.storyboard b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Base.lproj/Main.storyboard new file mode 100644 index 0000000..7b160a4 --- /dev/null +++ b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Base.lproj/Main.storyboard @@ -0,0 +1,142 @@ + + + + + + + + + + + + + Helvetica + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Info.plist b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Info.plist new file mode 100644 index 0000000..16be3b6 --- /dev/null +++ b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/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/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Money.swift b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Money.swift new file mode 100644 index 0000000..97ff28b --- /dev/null +++ b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/Money.swift @@ -0,0 +1,67 @@ +// +// Money.swift +// MoneyConverter +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import Foundation +import MapKit + +enum Currency:Int { + case usd = 0, krw, jpy, eur + + //Money symbol + var symbol:String { + get { + switch self { + case .usd : return "$" + case .krw : return "₩" + case .jpy : return "¥" + case .eur : return "€" + } + } + } + + //Convert ration + var ratio:Double { + get { + switch self { + case .usd : return 1.0 + case .krw : return 1115.5 + case .jpy : return 114.0 + case .eur : return 0.86 + } + } + } +} + + +struct Money { + + var usdollar = 0.0 + + init(_ _usdollar:Double){ + usdollar = _usdollar + } + + init(_ amount:Double, currency:Currency){ + usdollar = amount / currency.ratio + } + + func valueInCurrency(_ currency:Currency) -> String { + let convertedMoney = usdollar*currency.ratio + //Format currency + let fmt = NumberFormatter() + fmt.numberStyle = NumberFormatter.Style.decimal + + guard let formattedMoney = fmt.string(for: convertedMoney) else { + return "Error" + } + return "\(currency.symbol) " + "\(String(describing: formattedMoney))" + } +} + +//let money = Money(120.0) +//let koreanIncome = Money(500_000 , currency:.krw) diff --git a/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/ViewController.swift b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/ViewController.swift new file mode 100644 index 0000000..37e2347 --- /dev/null +++ b/SampleCodes/Swift 4/MoneyConverter/MoneyConverter/ViewController.swift @@ -0,0 +1,68 @@ +// +// ViewController.swift +// MoneyConverter +// +// Created by Hakyung Noa on 05/11/2017. +// Copyright © 2017 Hakyung Noah. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + @IBOutlet var currencySegment: UISegmentedControl! + @IBOutlet var sourceMoneyField: UITextField! + @IBOutlet var targetDollar: UILabel! + @IBOutlet var targetKRW: UILabel! + @IBOutlet var targetJPY: UILabel! + @IBOutlet var targetEUR: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + @IBAction func convertMoney(_ sender: Any) { + + guard let sourceCurrecy = Currency(rawValue:currencySegment.selectedSegmentIndex) else { + print("Source Currency Error") + return + } + + guard let sourceAmount = Double(sourceMoneyField.text!) else { + targetDollar.text = "Error" + targetKRW.text = "Error" + targetJPY.text = "Error" + targetEUR.text = "Error" + return + } + + let sourceMoney = Money(sourceAmount, currency: sourceCurrecy) + + let targetDollarOutput = sourceMoney.valueInCurrency(Currency.init(rawValue: 0)!) + let targetKrwOutput = sourceMoney.valueInCurrency(Currency.init(rawValue: 1)!) + let targetJpyOutput = sourceMoney.valueInCurrency(Currency.init(rawValue: 2)!) + let targetEurOutput = sourceMoney.valueInCurrency(Currency.init(rawValue: 3)!) + + targetDollar.text = targetDollarOutput + targetKRW.text = targetKrwOutput + targetJPY.text = targetJpyOutput + targetEUR.text = targetEurOutput + + +// for i in 0 ... 3 { +// targetMoneyString += sourceMoney.valueInCurrency(Currency.init(rawValue: i)!) +// targetMoneyString += "\r\n" +// } +// +// targetMoneyLabel.text = targetMoneyString + + } + +} +