├── 01-StopWatch ├── 01-StopWatch.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── leeguoyu.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── leeguoyu.xcuserdatad │ │ └── xcschemes │ │ ├── 01-StopWatch.xcscheme │ │ └── xcschememanagement.plist └── 01-StopWatch │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── pause.imageset │ │ ├── Contents.json │ │ └── pause.pdf │ └── play.imageset │ │ ├── Contents.json │ │ └── play.pdf │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── 02-ChineseHoroscope ├── 02-ChineseHoroscope.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── leeguoyu.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── leeguoyu.xcuserdatad │ │ └── xcschemes │ │ ├── 02-ChineseHoroscope.xcscheme │ │ └── xcschememanagement.plist └── 02-ChineseHoroscope │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── 0.imageset │ │ ├── 0.png │ │ ├── 0@2x.png │ │ └── Contents.json │ ├── 1.imageset │ │ ├── 1.png │ │ ├── 1@2x.png │ │ └── Contents.json │ ├── 10.imageset │ │ ├── 10.png │ │ ├── 10@2x.png │ │ └── Contents.json │ ├── 11.imageset │ │ ├── 11.png │ │ ├── 11@2x.png │ │ └── Contents.json │ ├── 2.imageset │ │ ├── 2.png │ │ ├── 2@2x.png │ │ └── Contents.json │ ├── 3.imageset │ │ ├── 3.png │ │ ├── 3@2x.png │ │ └── Contents.json │ ├── 4.imageset │ │ ├── 4.png │ │ ├── 4@2x.png │ │ └── Contents.json │ ├── 5.imageset │ │ ├── 5.png │ │ ├── 5@2x.png │ │ └── Contents.json │ ├── 6.imageset │ │ ├── 6.png │ │ ├── 6@2x.png │ │ └── Contents.json │ ├── 7.imageset │ │ ├── 7.png │ │ ├── 7@2x.png │ │ └── Contents.json │ ├── 8.imageset │ │ ├── 8.png │ │ ├── 8@2x.png │ │ └── Contents.json │ ├── 9.imageset │ │ ├── 9.png │ │ ├── 9@2x.png │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── 03-ChoosePartner ├── 03-ChoosePartner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── leeguoyu.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── leeguoyu.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── 03-ChoosePartner.xcscheme │ │ └── xcschememanagement.plist └── 03-ChoosePartner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── 04-BeautyGallery ├── 04-BeautyGallery.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── leeguoyu.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── leeguoyu.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── 04-BeautyGallery.xcscheme │ │ └── xcschememanagement.plist └── 04-BeautyGallery │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── facebook.imageset │ │ ├── Contents.json │ │ ├── facebook.png │ │ └── facebook@2x.png │ ├── fanbingbing.imageset │ │ ├── Contents.json │ │ ├── fangbingbing.jpg │ │ └── fangbingbing@2x.jpg │ ├── geisha.imageset │ │ ├── Contents.json │ │ ├── geisha.png │ │ └── geisha@2x.png │ ├── great_wall.imageset │ │ ├── Contents.json │ │ ├── great_wall.png │ │ └── great_wall@2x.png │ ├── japanese.imageset │ │ ├── Contents.json │ │ ├── japanese.jpg │ │ └── japanese@2x.jpg │ ├── korean.imageset │ │ ├── Contents.json │ │ ├── korean.jpg │ │ └── korean@2x.jpg │ ├── libingbing.imageset │ │ ├── Contents.json │ │ ├── libingbing.jpg │ │ └── libingbing@2x.jpg │ ├── origami.imageset │ │ ├── Contents.json │ │ ├── origami.png │ │ └── origami@2x.png │ ├── torii.imageset │ │ ├── Contents.json │ │ ├── torii.png │ │ └── torii@2x.png │ ├── twitter.imageset │ │ ├── Contents.json │ │ ├── twitter.png │ │ └── twitter@2x.png │ ├── wangfei.imageset │ │ ├── Contents.json │ │ ├── wangfei.jpg │ │ └── wangfei@2x.jpg │ ├── weibo.imageset │ │ ├── Contents.json │ │ ├── weibo.png │ │ └── weibo@2x.png │ ├── yangmi.imageset │ │ ├── Contents.json │ │ ├── yangmi.jpg │ │ └── yangmi@2x.jpg │ └── zhouxun.imageset │ │ ├── Contents.json │ │ ├── zhouxu.jpg │ │ └── zhouxu@2x.jpg │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── GalleryViewController.swift │ ├── Info.plist │ ├── KoreanViewController.swift │ ├── ViewController.swift │ └── ViewControllerExtension.swift ├── 05-ToDo ├── 05-ToDo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── leeguoyu.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── leeguoyu.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── 05-ToDo.xcscheme │ │ └── xcschememanagement.plist └── 05-ToDo │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── child-selected.imageset │ │ ├── Contents.json │ │ ├── child-selected.png │ │ ├── child-selected@2x.png │ │ └── child-selected@3x.png │ ├── child.imageset │ │ ├── Contents.json │ │ ├── child.png │ │ ├── child@2x.png │ │ └── child@3x.png │ ├── phone-selected.imageset │ │ ├── Contents.json │ │ ├── phone-selected.png │ │ ├── phone-selected@2x.png │ │ └── phone-selected@3x.png │ ├── phone.imageset │ │ ├── Contents.json │ │ ├── phone.png │ │ ├── phone@2x.png │ │ └── phone@3x.png │ ├── shopping-cart-selected.imageset │ │ ├── Contents.json │ │ ├── shopping-cart-selected.png │ │ ├── shopping-cart-selected@2x.png │ │ └── shopping-cart-selected@3x.png │ ├── shopping-cart.imageset │ │ ├── Contents.json │ │ ├── shopping-cart.png │ │ ├── shopping-cart@2x.png │ │ └── shopping-cart@3x.png │ ├── travel-selected.imageset │ │ ├── Contents.json │ │ ├── travel-selected.png │ │ ├── travel-selected@2x.png │ │ └── travel-selected@3x.png │ └── travel.imageset │ │ ├── Contents.json │ │ ├── travel.png │ │ ├── travel@2x.png │ │ └── travel@3x.png │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── TodoModel.swift │ └── ViewController.swift └── README.md /01-StopWatch/01-StopWatch.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 63052BA41C849E7800E56E14 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63052BA31C849E7800E56E14 /* AppDelegate.swift */; }; 11 | 63052BA61C849E7800E56E14 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63052BA51C849E7800E56E14 /* ViewController.swift */; }; 12 | 63052BA91C849E7800E56E14 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63052BA71C849E7800E56E14 /* Main.storyboard */; }; 13 | 63052BAB1C849E7800E56E14 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63052BAA1C849E7800E56E14 /* Assets.xcassets */; }; 14 | 63052BAE1C849E7800E56E14 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63052BAC1C849E7800E56E14 /* LaunchScreen.storyboard */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 63052BA01C849E7800E56E14 /* 01-StopWatch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "01-StopWatch.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | 63052BA31C849E7800E56E14 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 20 | 63052BA51C849E7800E56E14 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 21 | 63052BA81C849E7800E56E14 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 22 | 63052BAA1C849E7800E56E14 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | 63052BAD1C849E7800E56E14 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 24 | 63052BAF1C849E7800E56E14 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | /* End PBXFileReference section */ 26 | 27 | /* Begin PBXFrameworksBuildPhase section */ 28 | 63052B9D1C849E7800E56E14 /* Frameworks */ = { 29 | isa = PBXFrameworksBuildPhase; 30 | buildActionMask = 2147483647; 31 | files = ( 32 | ); 33 | runOnlyForDeploymentPostprocessing = 0; 34 | }; 35 | /* End PBXFrameworksBuildPhase section */ 36 | 37 | /* Begin PBXGroup section */ 38 | 63052B971C849E7800E56E14 = { 39 | isa = PBXGroup; 40 | children = ( 41 | 63052BA21C849E7800E56E14 /* 01-StopWatch */, 42 | 63052BA11C849E7800E56E14 /* Products */, 43 | ); 44 | sourceTree = ""; 45 | }; 46 | 63052BA11C849E7800E56E14 /* Products */ = { 47 | isa = PBXGroup; 48 | children = ( 49 | 63052BA01C849E7800E56E14 /* 01-StopWatch.app */, 50 | ); 51 | name = Products; 52 | sourceTree = ""; 53 | }; 54 | 63052BA21C849E7800E56E14 /* 01-StopWatch */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 63052BA31C849E7800E56E14 /* AppDelegate.swift */, 58 | 63052BA51C849E7800E56E14 /* ViewController.swift */, 59 | 63052BA71C849E7800E56E14 /* Main.storyboard */, 60 | 63052BAA1C849E7800E56E14 /* Assets.xcassets */, 61 | 63052BAC1C849E7800E56E14 /* LaunchScreen.storyboard */, 62 | 63052BAF1C849E7800E56E14 /* Info.plist */, 63 | ); 64 | path = "01-StopWatch"; 65 | sourceTree = ""; 66 | }; 67 | /* End PBXGroup section */ 68 | 69 | /* Begin PBXNativeTarget section */ 70 | 63052B9F1C849E7800E56E14 /* 01-StopWatch */ = { 71 | isa = PBXNativeTarget; 72 | buildConfigurationList = 63052BB21C849E7800E56E14 /* Build configuration list for PBXNativeTarget "01-StopWatch" */; 73 | buildPhases = ( 74 | 63052B9C1C849E7800E56E14 /* Sources */, 75 | 63052B9D1C849E7800E56E14 /* Frameworks */, 76 | 63052B9E1C849E7800E56E14 /* Resources */, 77 | ); 78 | buildRules = ( 79 | ); 80 | dependencies = ( 81 | ); 82 | name = "01-StopWatch"; 83 | productName = "01-StopWatch"; 84 | productReference = 63052BA01C849E7800E56E14 /* 01-StopWatch.app */; 85 | productType = "com.apple.product-type.application"; 86 | }; 87 | /* End PBXNativeTarget section */ 88 | 89 | /* Begin PBXProject section */ 90 | 63052B981C849E7800E56E14 /* Project object */ = { 91 | isa = PBXProject; 92 | attributes = { 93 | LastSwiftUpdateCheck = 0720; 94 | LastUpgradeCheck = 0720; 95 | ORGANIZATIONNAME = leeguoyu; 96 | TargetAttributes = { 97 | 63052B9F1C849E7800E56E14 = { 98 | CreatedOnToolsVersion = 7.2.1; 99 | DevelopmentTeam = 5BYRRUBWU9; 100 | }; 101 | }; 102 | }; 103 | buildConfigurationList = 63052B9B1C849E7800E56E14 /* Build configuration list for PBXProject "01-StopWatch" */; 104 | compatibilityVersion = "Xcode 3.2"; 105 | developmentRegion = English; 106 | hasScannedForEncodings = 0; 107 | knownRegions = ( 108 | en, 109 | Base, 110 | ); 111 | mainGroup = 63052B971C849E7800E56E14; 112 | productRefGroup = 63052BA11C849E7800E56E14 /* Products */; 113 | projectDirPath = ""; 114 | projectRoot = ""; 115 | targets = ( 116 | 63052B9F1C849E7800E56E14 /* 01-StopWatch */, 117 | ); 118 | }; 119 | /* End PBXProject section */ 120 | 121 | /* Begin PBXResourcesBuildPhase section */ 122 | 63052B9E1C849E7800E56E14 /* Resources */ = { 123 | isa = PBXResourcesBuildPhase; 124 | buildActionMask = 2147483647; 125 | files = ( 126 | 63052BAE1C849E7800E56E14 /* LaunchScreen.storyboard in Resources */, 127 | 63052BAB1C849E7800E56E14 /* Assets.xcassets in Resources */, 128 | 63052BA91C849E7800E56E14 /* Main.storyboard in Resources */, 129 | ); 130 | runOnlyForDeploymentPostprocessing = 0; 131 | }; 132 | /* End PBXResourcesBuildPhase section */ 133 | 134 | /* Begin PBXSourcesBuildPhase section */ 135 | 63052B9C1C849E7800E56E14 /* Sources */ = { 136 | isa = PBXSourcesBuildPhase; 137 | buildActionMask = 2147483647; 138 | files = ( 139 | 63052BA61C849E7800E56E14 /* ViewController.swift in Sources */, 140 | 63052BA41C849E7800E56E14 /* AppDelegate.swift in Sources */, 141 | ); 142 | runOnlyForDeploymentPostprocessing = 0; 143 | }; 144 | /* End PBXSourcesBuildPhase section */ 145 | 146 | /* Begin PBXVariantGroup section */ 147 | 63052BA71C849E7800E56E14 /* Main.storyboard */ = { 148 | isa = PBXVariantGroup; 149 | children = ( 150 | 63052BA81C849E7800E56E14 /* Base */, 151 | ); 152 | name = Main.storyboard; 153 | sourceTree = ""; 154 | }; 155 | 63052BAC1C849E7800E56E14 /* LaunchScreen.storyboard */ = { 156 | isa = PBXVariantGroup; 157 | children = ( 158 | 63052BAD1C849E7800E56E14 /* Base */, 159 | ); 160 | name = LaunchScreen.storyboard; 161 | sourceTree = ""; 162 | }; 163 | /* End PBXVariantGroup section */ 164 | 165 | /* Begin XCBuildConfiguration section */ 166 | 63052BB01C849E7800E56E14 /* Debug */ = { 167 | isa = XCBuildConfiguration; 168 | buildSettings = { 169 | ALWAYS_SEARCH_USER_PATHS = NO; 170 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 171 | CLANG_CXX_LIBRARY = "libc++"; 172 | CLANG_ENABLE_MODULES = YES; 173 | CLANG_ENABLE_OBJC_ARC = YES; 174 | CLANG_WARN_BOOL_CONVERSION = YES; 175 | CLANG_WARN_CONSTANT_CONVERSION = YES; 176 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 177 | CLANG_WARN_EMPTY_BODY = YES; 178 | CLANG_WARN_ENUM_CONVERSION = YES; 179 | CLANG_WARN_INT_CONVERSION = YES; 180 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 181 | CLANG_WARN_UNREACHABLE_CODE = YES; 182 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 183 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 184 | COPY_PHASE_STRIP = NO; 185 | DEBUG_INFORMATION_FORMAT = dwarf; 186 | ENABLE_STRICT_OBJC_MSGSEND = YES; 187 | ENABLE_TESTABILITY = YES; 188 | GCC_C_LANGUAGE_STANDARD = gnu99; 189 | GCC_DYNAMIC_NO_PIC = NO; 190 | GCC_NO_COMMON_BLOCKS = YES; 191 | GCC_OPTIMIZATION_LEVEL = 0; 192 | GCC_PREPROCESSOR_DEFINITIONS = ( 193 | "DEBUG=1", 194 | "$(inherited)", 195 | ); 196 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 197 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 198 | GCC_WARN_UNDECLARED_SELECTOR = YES; 199 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 200 | GCC_WARN_UNUSED_FUNCTION = YES; 201 | GCC_WARN_UNUSED_VARIABLE = YES; 202 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 203 | MTL_ENABLE_DEBUG_INFO = YES; 204 | ONLY_ACTIVE_ARCH = YES; 205 | SDKROOT = iphoneos; 206 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 207 | }; 208 | name = Debug; 209 | }; 210 | 63052BB11C849E7800E56E14 /* Release */ = { 211 | isa = XCBuildConfiguration; 212 | buildSettings = { 213 | ALWAYS_SEARCH_USER_PATHS = NO; 214 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 215 | CLANG_CXX_LIBRARY = "libc++"; 216 | CLANG_ENABLE_MODULES = YES; 217 | CLANG_ENABLE_OBJC_ARC = YES; 218 | CLANG_WARN_BOOL_CONVERSION = YES; 219 | CLANG_WARN_CONSTANT_CONVERSION = YES; 220 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 221 | CLANG_WARN_EMPTY_BODY = YES; 222 | CLANG_WARN_ENUM_CONVERSION = YES; 223 | CLANG_WARN_INT_CONVERSION = YES; 224 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 225 | CLANG_WARN_UNREACHABLE_CODE = YES; 226 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 227 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 228 | COPY_PHASE_STRIP = NO; 229 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 230 | ENABLE_NS_ASSERTIONS = NO; 231 | ENABLE_STRICT_OBJC_MSGSEND = YES; 232 | GCC_C_LANGUAGE_STANDARD = gnu99; 233 | GCC_NO_COMMON_BLOCKS = YES; 234 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 235 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 236 | GCC_WARN_UNDECLARED_SELECTOR = YES; 237 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 238 | GCC_WARN_UNUSED_FUNCTION = YES; 239 | GCC_WARN_UNUSED_VARIABLE = YES; 240 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 241 | MTL_ENABLE_DEBUG_INFO = NO; 242 | SDKROOT = iphoneos; 243 | VALIDATE_PRODUCT = YES; 244 | }; 245 | name = Release; 246 | }; 247 | 63052BB31C849E7800E56E14 /* Debug */ = { 248 | isa = XCBuildConfiguration; 249 | buildSettings = { 250 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 251 | INFOPLIST_FILE = "01-StopWatch/Info.plist"; 252 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 253 | PRODUCT_BUNDLE_IDENTIFIER = "com.xmosh.-1-StopWatch"; 254 | PRODUCT_NAME = "$(TARGET_NAME)"; 255 | }; 256 | name = Debug; 257 | }; 258 | 63052BB41C849E7800E56E14 /* Release */ = { 259 | isa = XCBuildConfiguration; 260 | buildSettings = { 261 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 262 | INFOPLIST_FILE = "01-StopWatch/Info.plist"; 263 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 264 | PRODUCT_BUNDLE_IDENTIFIER = "com.xmosh.-1-StopWatch"; 265 | PRODUCT_NAME = "$(TARGET_NAME)"; 266 | }; 267 | name = Release; 268 | }; 269 | /* End XCBuildConfiguration section */ 270 | 271 | /* Begin XCConfigurationList section */ 272 | 63052B9B1C849E7800E56E14 /* Build configuration list for PBXProject "01-StopWatch" */ = { 273 | isa = XCConfigurationList; 274 | buildConfigurations = ( 275 | 63052BB01C849E7800E56E14 /* Debug */, 276 | 63052BB11C849E7800E56E14 /* Release */, 277 | ); 278 | defaultConfigurationIsVisible = 0; 279 | defaultConfigurationName = Release; 280 | }; 281 | 63052BB21C849E7800E56E14 /* Build configuration list for PBXNativeTarget "01-StopWatch" */ = { 282 | isa = XCConfigurationList; 283 | buildConfigurations = ( 284 | 63052BB31C849E7800E56E14 /* Debug */, 285 | 63052BB41C849E7800E56E14 /* Release */, 286 | ); 287 | defaultConfigurationIsVisible = 0; 288 | }; 289 | /* End XCConfigurationList section */ 290 | }; 291 | rootObject = 63052B981C849E7800E56E14 /* Project object */; 292 | } 293 | -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch.xcodeproj/project.xcworkspace/xcuserdata/leeguoyu.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/01-StopWatch/01-StopWatch.xcodeproj/project.xcworkspace/xcuserdata/leeguoyu.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcschemes/01-StopWatch.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 01-StopWatch.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 63052B9F1C849E7800E56E14 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // 01-StopWatch 4 | // 5 | // Created by leeguoyu on 16/2/29. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch/Assets.xcassets/pause.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "pause.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch/Assets.xcassets/pause.imageset/pause.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/01-StopWatch/01-StopWatch/Assets.xcassets/pause.imageset/pause.pdf -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch/Assets.xcassets/play.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "play.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch/Assets.xcassets/play.imageset/play.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/01-StopWatch/01-StopWatch/Assets.xcassets/play.imageset/play.pdf -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 42 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /01-StopWatch/01-StopWatch/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // 01-StopWatch 4 | // 5 | // Created by leeguoyu on 16/2/29. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet weak var timeLabel: UILabel! 14 | 15 | @IBOutlet weak var playButton: UIButton! 16 | @IBOutlet weak var pauseButton: UIButton! 17 | @IBOutlet weak var resetButton: UIButton! 18 | 19 | var counter = 0.0 20 | var timer = NSTimer() 21 | 22 | override func viewDidLoad() { 23 | super.viewDidLoad() 24 | pauseButton.enabled = false 25 | resetButton.enabled = false 26 | timeLabel.text = String(counter) 27 | 28 | } 29 | 30 | //点击play按钮 31 | @IBAction func playButtonDidClick(sender: AnyObject){ 32 | 33 | playButton.enabled = false 34 | pauseButton.enabled = true 35 | resetButton.enabled = true 36 | timer = NSTimer.scheduledTimerWithTimeInterval(0.1, target: self, selector: Selector("updateTimer"), userInfo: nil, repeats: true) 37 | 38 | } 39 | 40 | func updateTimer(){ 41 | 42 | counter += 0.1 43 | //这里一定要限制counter的小数位,不然会变超长 44 | timeLabel.text = String(format:"%.1f", counter) 45 | 46 | } 47 | //点击pause按钮 48 | @IBAction func pauseButtonDidClick(sender: AnyObject){ 49 | playButton.enabled = true 50 | pauseButton.enabled = false 51 | timer.invalidate() 52 | } 53 | //点击reset按钮 54 | @IBAction func resetButtonDidClick(sender: AnyObject){ 55 | timer.invalidate() 56 | counter = 0.0 57 | timeLabel.text = String(counter) 58 | playButton.enabled = true 59 | pauseButton.enabled = false 60 | } 61 | 62 | 63 | 64 | } 65 | 66 | -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 63052BC21C8A9EBC00E56E14 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63052BC11C8A9EBC00E56E14 /* AppDelegate.swift */; }; 11 | 63052BC41C8A9EBC00E56E14 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63052BC31C8A9EBC00E56E14 /* ViewController.swift */; }; 12 | 63052BC71C8A9EBC00E56E14 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63052BC51C8A9EBC00E56E14 /* Main.storyboard */; }; 13 | 63052BC91C8A9EBC00E56E14 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63052BC81C8A9EBC00E56E14 /* Assets.xcassets */; }; 14 | 63052BCC1C8A9EBC00E56E14 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63052BCA1C8A9EBC00E56E14 /* LaunchScreen.storyboard */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 63052BBE1C8A9EBC00E56E14 /* 02-ChineseHoroscope.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "02-ChineseHoroscope.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | 63052BC11C8A9EBC00E56E14 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 20 | 63052BC31C8A9EBC00E56E14 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 21 | 63052BC61C8A9EBC00E56E14 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 22 | 63052BC81C8A9EBC00E56E14 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | 63052BCB1C8A9EBC00E56E14 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 24 | 63052BCD1C8A9EBC00E56E14 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | /* End PBXFileReference section */ 26 | 27 | /* Begin PBXFrameworksBuildPhase section */ 28 | 63052BBB1C8A9EBC00E56E14 /* Frameworks */ = { 29 | isa = PBXFrameworksBuildPhase; 30 | buildActionMask = 2147483647; 31 | files = ( 32 | ); 33 | runOnlyForDeploymentPostprocessing = 0; 34 | }; 35 | /* End PBXFrameworksBuildPhase section */ 36 | 37 | /* Begin PBXGroup section */ 38 | 63052BB51C8A9EBC00E56E14 = { 39 | isa = PBXGroup; 40 | children = ( 41 | 63052BC01C8A9EBC00E56E14 /* 02-ChineseHoroscope */, 42 | 63052BBF1C8A9EBC00E56E14 /* Products */, 43 | ); 44 | sourceTree = ""; 45 | }; 46 | 63052BBF1C8A9EBC00E56E14 /* Products */ = { 47 | isa = PBXGroup; 48 | children = ( 49 | 63052BBE1C8A9EBC00E56E14 /* 02-ChineseHoroscope.app */, 50 | ); 51 | name = Products; 52 | sourceTree = ""; 53 | }; 54 | 63052BC01C8A9EBC00E56E14 /* 02-ChineseHoroscope */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 63052BC11C8A9EBC00E56E14 /* AppDelegate.swift */, 58 | 63052BC31C8A9EBC00E56E14 /* ViewController.swift */, 59 | 63052BC51C8A9EBC00E56E14 /* Main.storyboard */, 60 | 63052BC81C8A9EBC00E56E14 /* Assets.xcassets */, 61 | 63052BCA1C8A9EBC00E56E14 /* LaunchScreen.storyboard */, 62 | 63052BCD1C8A9EBC00E56E14 /* Info.plist */, 63 | ); 64 | path = "02-ChineseHoroscope"; 65 | sourceTree = ""; 66 | }; 67 | /* End PBXGroup section */ 68 | 69 | /* Begin PBXNativeTarget section */ 70 | 63052BBD1C8A9EBC00E56E14 /* 02-ChineseHoroscope */ = { 71 | isa = PBXNativeTarget; 72 | buildConfigurationList = 63052BD01C8A9EBC00E56E14 /* Build configuration list for PBXNativeTarget "02-ChineseHoroscope" */; 73 | buildPhases = ( 74 | 63052BBA1C8A9EBC00E56E14 /* Sources */, 75 | 63052BBB1C8A9EBC00E56E14 /* Frameworks */, 76 | 63052BBC1C8A9EBC00E56E14 /* Resources */, 77 | ); 78 | buildRules = ( 79 | ); 80 | dependencies = ( 81 | ); 82 | name = "02-ChineseHoroscope"; 83 | productName = "02-ChineseHoroscope"; 84 | productReference = 63052BBE1C8A9EBC00E56E14 /* 02-ChineseHoroscope.app */; 85 | productType = "com.apple.product-type.application"; 86 | }; 87 | /* End PBXNativeTarget section */ 88 | 89 | /* Begin PBXProject section */ 90 | 63052BB61C8A9EBC00E56E14 /* Project object */ = { 91 | isa = PBXProject; 92 | attributes = { 93 | LastSwiftUpdateCheck = 0720; 94 | LastUpgradeCheck = 0720; 95 | ORGANIZATIONNAME = leeguoyu; 96 | TargetAttributes = { 97 | 63052BBD1C8A9EBC00E56E14 = { 98 | CreatedOnToolsVersion = 7.2.1; 99 | DevelopmentTeam = 5BYRRUBWU9; 100 | }; 101 | }; 102 | }; 103 | buildConfigurationList = 63052BB91C8A9EBC00E56E14 /* Build configuration list for PBXProject "02-ChineseHoroscope" */; 104 | compatibilityVersion = "Xcode 3.2"; 105 | developmentRegion = English; 106 | hasScannedForEncodings = 0; 107 | knownRegions = ( 108 | en, 109 | Base, 110 | ); 111 | mainGroup = 63052BB51C8A9EBC00E56E14; 112 | productRefGroup = 63052BBF1C8A9EBC00E56E14 /* Products */; 113 | projectDirPath = ""; 114 | projectRoot = ""; 115 | targets = ( 116 | 63052BBD1C8A9EBC00E56E14 /* 02-ChineseHoroscope */, 117 | ); 118 | }; 119 | /* End PBXProject section */ 120 | 121 | /* Begin PBXResourcesBuildPhase section */ 122 | 63052BBC1C8A9EBC00E56E14 /* Resources */ = { 123 | isa = PBXResourcesBuildPhase; 124 | buildActionMask = 2147483647; 125 | files = ( 126 | 63052BCC1C8A9EBC00E56E14 /* LaunchScreen.storyboard in Resources */, 127 | 63052BC91C8A9EBC00E56E14 /* Assets.xcassets in Resources */, 128 | 63052BC71C8A9EBC00E56E14 /* Main.storyboard in Resources */, 129 | ); 130 | runOnlyForDeploymentPostprocessing = 0; 131 | }; 132 | /* End PBXResourcesBuildPhase section */ 133 | 134 | /* Begin PBXSourcesBuildPhase section */ 135 | 63052BBA1C8A9EBC00E56E14 /* Sources */ = { 136 | isa = PBXSourcesBuildPhase; 137 | buildActionMask = 2147483647; 138 | files = ( 139 | 63052BC41C8A9EBC00E56E14 /* ViewController.swift in Sources */, 140 | 63052BC21C8A9EBC00E56E14 /* AppDelegate.swift in Sources */, 141 | ); 142 | runOnlyForDeploymentPostprocessing = 0; 143 | }; 144 | /* End PBXSourcesBuildPhase section */ 145 | 146 | /* Begin PBXVariantGroup section */ 147 | 63052BC51C8A9EBC00E56E14 /* Main.storyboard */ = { 148 | isa = PBXVariantGroup; 149 | children = ( 150 | 63052BC61C8A9EBC00E56E14 /* Base */, 151 | ); 152 | name = Main.storyboard; 153 | sourceTree = ""; 154 | }; 155 | 63052BCA1C8A9EBC00E56E14 /* LaunchScreen.storyboard */ = { 156 | isa = PBXVariantGroup; 157 | children = ( 158 | 63052BCB1C8A9EBC00E56E14 /* Base */, 159 | ); 160 | name = LaunchScreen.storyboard; 161 | sourceTree = ""; 162 | }; 163 | /* End PBXVariantGroup section */ 164 | 165 | /* Begin XCBuildConfiguration section */ 166 | 63052BCE1C8A9EBC00E56E14 /* Debug */ = { 167 | isa = XCBuildConfiguration; 168 | buildSettings = { 169 | ALWAYS_SEARCH_USER_PATHS = NO; 170 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 171 | CLANG_CXX_LIBRARY = "libc++"; 172 | CLANG_ENABLE_MODULES = YES; 173 | CLANG_ENABLE_OBJC_ARC = YES; 174 | CLANG_WARN_BOOL_CONVERSION = YES; 175 | CLANG_WARN_CONSTANT_CONVERSION = YES; 176 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 177 | CLANG_WARN_EMPTY_BODY = YES; 178 | CLANG_WARN_ENUM_CONVERSION = YES; 179 | CLANG_WARN_INT_CONVERSION = YES; 180 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 181 | CLANG_WARN_UNREACHABLE_CODE = YES; 182 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 183 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 184 | COPY_PHASE_STRIP = NO; 185 | DEBUG_INFORMATION_FORMAT = dwarf; 186 | ENABLE_STRICT_OBJC_MSGSEND = YES; 187 | ENABLE_TESTABILITY = YES; 188 | GCC_C_LANGUAGE_STANDARD = gnu99; 189 | GCC_DYNAMIC_NO_PIC = NO; 190 | GCC_NO_COMMON_BLOCKS = YES; 191 | GCC_OPTIMIZATION_LEVEL = 0; 192 | GCC_PREPROCESSOR_DEFINITIONS = ( 193 | "DEBUG=1", 194 | "$(inherited)", 195 | ); 196 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 197 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 198 | GCC_WARN_UNDECLARED_SELECTOR = YES; 199 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 200 | GCC_WARN_UNUSED_FUNCTION = YES; 201 | GCC_WARN_UNUSED_VARIABLE = YES; 202 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 203 | MTL_ENABLE_DEBUG_INFO = YES; 204 | ONLY_ACTIVE_ARCH = YES; 205 | SDKROOT = iphoneos; 206 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 207 | }; 208 | name = Debug; 209 | }; 210 | 63052BCF1C8A9EBC00E56E14 /* Release */ = { 211 | isa = XCBuildConfiguration; 212 | buildSettings = { 213 | ALWAYS_SEARCH_USER_PATHS = NO; 214 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 215 | CLANG_CXX_LIBRARY = "libc++"; 216 | CLANG_ENABLE_MODULES = YES; 217 | CLANG_ENABLE_OBJC_ARC = YES; 218 | CLANG_WARN_BOOL_CONVERSION = YES; 219 | CLANG_WARN_CONSTANT_CONVERSION = YES; 220 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 221 | CLANG_WARN_EMPTY_BODY = YES; 222 | CLANG_WARN_ENUM_CONVERSION = YES; 223 | CLANG_WARN_INT_CONVERSION = YES; 224 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 225 | CLANG_WARN_UNREACHABLE_CODE = YES; 226 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 227 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 228 | COPY_PHASE_STRIP = NO; 229 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 230 | ENABLE_NS_ASSERTIONS = NO; 231 | ENABLE_STRICT_OBJC_MSGSEND = YES; 232 | GCC_C_LANGUAGE_STANDARD = gnu99; 233 | GCC_NO_COMMON_BLOCKS = YES; 234 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 235 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 236 | GCC_WARN_UNDECLARED_SELECTOR = YES; 237 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 238 | GCC_WARN_UNUSED_FUNCTION = YES; 239 | GCC_WARN_UNUSED_VARIABLE = YES; 240 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 241 | MTL_ENABLE_DEBUG_INFO = NO; 242 | SDKROOT = iphoneos; 243 | VALIDATE_PRODUCT = YES; 244 | }; 245 | name = Release; 246 | }; 247 | 63052BD11C8A9EBC00E56E14 /* Debug */ = { 248 | isa = XCBuildConfiguration; 249 | buildSettings = { 250 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 251 | INFOPLIST_FILE = "02-ChineseHoroscope/Info.plist"; 252 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 253 | PRODUCT_BUNDLE_IDENTIFIER = "com.xmosh.-2-ChineseHoroscope"; 254 | PRODUCT_NAME = "$(TARGET_NAME)"; 255 | }; 256 | name = Debug; 257 | }; 258 | 63052BD21C8A9EBC00E56E14 /* Release */ = { 259 | isa = XCBuildConfiguration; 260 | buildSettings = { 261 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 262 | INFOPLIST_FILE = "02-ChineseHoroscope/Info.plist"; 263 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 264 | PRODUCT_BUNDLE_IDENTIFIER = "com.xmosh.-2-ChineseHoroscope"; 265 | PRODUCT_NAME = "$(TARGET_NAME)"; 266 | }; 267 | name = Release; 268 | }; 269 | /* End XCBuildConfiguration section */ 270 | 271 | /* Begin XCConfigurationList section */ 272 | 63052BB91C8A9EBC00E56E14 /* Build configuration list for PBXProject "02-ChineseHoroscope" */ = { 273 | isa = XCConfigurationList; 274 | buildConfigurations = ( 275 | 63052BCE1C8A9EBC00E56E14 /* Debug */, 276 | 63052BCF1C8A9EBC00E56E14 /* Release */, 277 | ); 278 | defaultConfigurationIsVisible = 0; 279 | defaultConfigurationName = Release; 280 | }; 281 | 63052BD01C8A9EBC00E56E14 /* Build configuration list for PBXNativeTarget "02-ChineseHoroscope" */ = { 282 | isa = XCConfigurationList; 283 | buildConfigurations = ( 284 | 63052BD11C8A9EBC00E56E14 /* Debug */, 285 | 63052BD21C8A9EBC00E56E14 /* Release */, 286 | ); 287 | defaultConfigurationIsVisible = 0; 288 | }; 289 | /* End XCConfigurationList section */ 290 | }; 291 | rootObject = 63052BB61C8A9EBC00E56E14 /* Project object */; 292 | } 293 | -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope.xcodeproj/project.xcworkspace/xcuserdata/leeguoyu.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope.xcodeproj/project.xcworkspace/xcuserdata/leeguoyu.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcschemes/02-ChineseHoroscope.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 02-ChineseHoroscope.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 63052BBD1C8A9EBC00E56E14 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // 02-ChineseHoroscope 4 | // 5 | // Created by leeguoyu on 16/3/5. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/0.imageset/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/0.imageset/0.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/0.imageset/0@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/0.imageset/0@2x.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/0.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "0.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "0@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/1.imageset/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/1.imageset/1.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/1.imageset/1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/1.imageset/1@2x.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "1@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/10.imageset/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/10.imageset/10.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/10.imageset/10@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/10.imageset/10@2x.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/10.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "10.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "10@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/11.imageset/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/11.imageset/11.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/11.imageset/11@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/11.imageset/11@2x.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/11.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "11.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "11@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/2.imageset/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/2.imageset/2.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/2.imageset/2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/2.imageset/2@2x.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "2.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "2@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/3.imageset/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/3.imageset/3.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/3.imageset/3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/3.imageset/3@2x.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "3.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "3@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/4.imageset/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/4.imageset/4.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/4.imageset/4@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/4.imageset/4@2x.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "4.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "4@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/5.imageset/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/5.imageset/5.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/5.imageset/5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/5.imageset/5@2x.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "5.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "5@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/6.imageset/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/6.imageset/6.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/6.imageset/6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/6.imageset/6@2x.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "6.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "6@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/7.imageset/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/7.imageset/7.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/7.imageset/7@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/7.imageset/7@2x.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/7.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "7.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "7@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/8.imageset/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/8.imageset/8.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/8.imageset/8@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/8.imageset/8@2x.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/8.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "8.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "8@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/9.imageset/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/9.imageset/9.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/9.imageset/9@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/9.imageset/9@2x.png -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/9.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "9.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "9@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /02-ChineseHoroscope/02-ChineseHoroscope/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // 02-ChineseHoroscope 4 | // 5 | // Created by leeguoyu on 16/3/5. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet weak var yearTextField: UITextField! 14 | @IBOutlet weak var confirmButton: UIButton! 15 | @IBOutlet weak var horoscopeImageView: UIImageView! 16 | 17 | let offset = 4 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | 22 | } 23 | 24 | @IBAction func confirmButtonDidClick(sender: AnyObject) { 25 | 26 | yearTextField.resignFirstResponder() 27 | 28 | if let year : Int = Int(yearTextField.text!){ 29 | 30 | let imageNumber = (year - offset) % 12 31 | horoscopeImageView.image = UIImage(named: String(imageNumber)) 32 | 33 | } 34 | } 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /03-ChoosePartner/03-ChoosePartner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 63408A221C8C150400C6A8B3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63408A211C8C150400C6A8B3 /* AppDelegate.swift */; }; 11 | 63408A241C8C150400C6A8B3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63408A231C8C150400C6A8B3 /* ViewController.swift */; }; 12 | 63408A271C8C150400C6A8B3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63408A251C8C150400C6A8B3 /* Main.storyboard */; }; 13 | 63408A291C8C150400C6A8B3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63408A281C8C150400C6A8B3 /* Assets.xcassets */; }; 14 | 63408A2C1C8C150400C6A8B3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63408A2A1C8C150400C6A8B3 /* LaunchScreen.storyboard */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 63408A1E1C8C150400C6A8B3 /* 03-ChoosePartner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "03-ChoosePartner.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | 63408A211C8C150400C6A8B3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 20 | 63408A231C8C150400C6A8B3 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 21 | 63408A261C8C150400C6A8B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 22 | 63408A281C8C150400C6A8B3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | 63408A2B1C8C150400C6A8B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 24 | 63408A2D1C8C150400C6A8B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | /* End PBXFileReference section */ 26 | 27 | /* Begin PBXFrameworksBuildPhase section */ 28 | 63408A1B1C8C150400C6A8B3 /* Frameworks */ = { 29 | isa = PBXFrameworksBuildPhase; 30 | buildActionMask = 2147483647; 31 | files = ( 32 | ); 33 | runOnlyForDeploymentPostprocessing = 0; 34 | }; 35 | /* End PBXFrameworksBuildPhase section */ 36 | 37 | /* Begin PBXGroup section */ 38 | 63408A151C8C150400C6A8B3 = { 39 | isa = PBXGroup; 40 | children = ( 41 | 63408A201C8C150400C6A8B3 /* 03-ChoosePartner */, 42 | 63408A1F1C8C150400C6A8B3 /* Products */, 43 | ); 44 | sourceTree = ""; 45 | }; 46 | 63408A1F1C8C150400C6A8B3 /* Products */ = { 47 | isa = PBXGroup; 48 | children = ( 49 | 63408A1E1C8C150400C6A8B3 /* 03-ChoosePartner.app */, 50 | ); 51 | name = Products; 52 | sourceTree = ""; 53 | }; 54 | 63408A201C8C150400C6A8B3 /* 03-ChoosePartner */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 63408A211C8C150400C6A8B3 /* AppDelegate.swift */, 58 | 63408A231C8C150400C6A8B3 /* ViewController.swift */, 59 | 63408A251C8C150400C6A8B3 /* Main.storyboard */, 60 | 63408A281C8C150400C6A8B3 /* Assets.xcassets */, 61 | 63408A2A1C8C150400C6A8B3 /* LaunchScreen.storyboard */, 62 | 63408A2D1C8C150400C6A8B3 /* Info.plist */, 63 | ); 64 | path = "03-ChoosePartner"; 65 | sourceTree = ""; 66 | }; 67 | /* End PBXGroup section */ 68 | 69 | /* Begin PBXNativeTarget section */ 70 | 63408A1D1C8C150400C6A8B3 /* 03-ChoosePartner */ = { 71 | isa = PBXNativeTarget; 72 | buildConfigurationList = 63408A301C8C150400C6A8B3 /* Build configuration list for PBXNativeTarget "03-ChoosePartner" */; 73 | buildPhases = ( 74 | 63408A1A1C8C150400C6A8B3 /* Sources */, 75 | 63408A1B1C8C150400C6A8B3 /* Frameworks */, 76 | 63408A1C1C8C150400C6A8B3 /* Resources */, 77 | ); 78 | buildRules = ( 79 | ); 80 | dependencies = ( 81 | ); 82 | name = "03-ChoosePartner"; 83 | productName = "03-ChoosePartner"; 84 | productReference = 63408A1E1C8C150400C6A8B3 /* 03-ChoosePartner.app */; 85 | productType = "com.apple.product-type.application"; 86 | }; 87 | /* End PBXNativeTarget section */ 88 | 89 | /* Begin PBXProject section */ 90 | 63408A161C8C150400C6A8B3 /* Project object */ = { 91 | isa = PBXProject; 92 | attributes = { 93 | LastSwiftUpdateCheck = 0720; 94 | LastUpgradeCheck = 0720; 95 | ORGANIZATIONNAME = leeguoyu; 96 | TargetAttributes = { 97 | 63408A1D1C8C150400C6A8B3 = { 98 | CreatedOnToolsVersion = 7.2.1; 99 | DevelopmentTeam = 5BYRRUBWU9; 100 | }; 101 | }; 102 | }; 103 | buildConfigurationList = 63408A191C8C150400C6A8B3 /* Build configuration list for PBXProject "03-ChoosePartner" */; 104 | compatibilityVersion = "Xcode 3.2"; 105 | developmentRegion = English; 106 | hasScannedForEncodings = 0; 107 | knownRegions = ( 108 | en, 109 | Base, 110 | ); 111 | mainGroup = 63408A151C8C150400C6A8B3; 112 | productRefGroup = 63408A1F1C8C150400C6A8B3 /* Products */; 113 | projectDirPath = ""; 114 | projectRoot = ""; 115 | targets = ( 116 | 63408A1D1C8C150400C6A8B3 /* 03-ChoosePartner */, 117 | ); 118 | }; 119 | /* End PBXProject section */ 120 | 121 | /* Begin PBXResourcesBuildPhase section */ 122 | 63408A1C1C8C150400C6A8B3 /* Resources */ = { 123 | isa = PBXResourcesBuildPhase; 124 | buildActionMask = 2147483647; 125 | files = ( 126 | 63408A2C1C8C150400C6A8B3 /* LaunchScreen.storyboard in Resources */, 127 | 63408A291C8C150400C6A8B3 /* Assets.xcassets in Resources */, 128 | 63408A271C8C150400C6A8B3 /* Main.storyboard in Resources */, 129 | ); 130 | runOnlyForDeploymentPostprocessing = 0; 131 | }; 132 | /* End PBXResourcesBuildPhase section */ 133 | 134 | /* Begin PBXSourcesBuildPhase section */ 135 | 63408A1A1C8C150400C6A8B3 /* Sources */ = { 136 | isa = PBXSourcesBuildPhase; 137 | buildActionMask = 2147483647; 138 | files = ( 139 | 63408A241C8C150400C6A8B3 /* ViewController.swift in Sources */, 140 | 63408A221C8C150400C6A8B3 /* AppDelegate.swift in Sources */, 141 | ); 142 | runOnlyForDeploymentPostprocessing = 0; 143 | }; 144 | /* End PBXSourcesBuildPhase section */ 145 | 146 | /* Begin PBXVariantGroup section */ 147 | 63408A251C8C150400C6A8B3 /* Main.storyboard */ = { 148 | isa = PBXVariantGroup; 149 | children = ( 150 | 63408A261C8C150400C6A8B3 /* Base */, 151 | ); 152 | name = Main.storyboard; 153 | sourceTree = ""; 154 | }; 155 | 63408A2A1C8C150400C6A8B3 /* LaunchScreen.storyboard */ = { 156 | isa = PBXVariantGroup; 157 | children = ( 158 | 63408A2B1C8C150400C6A8B3 /* Base */, 159 | ); 160 | name = LaunchScreen.storyboard; 161 | sourceTree = ""; 162 | }; 163 | /* End PBXVariantGroup section */ 164 | 165 | /* Begin XCBuildConfiguration section */ 166 | 63408A2E1C8C150400C6A8B3 /* Debug */ = { 167 | isa = XCBuildConfiguration; 168 | buildSettings = { 169 | ALWAYS_SEARCH_USER_PATHS = NO; 170 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 171 | CLANG_CXX_LIBRARY = "libc++"; 172 | CLANG_ENABLE_MODULES = YES; 173 | CLANG_ENABLE_OBJC_ARC = YES; 174 | CLANG_WARN_BOOL_CONVERSION = YES; 175 | CLANG_WARN_CONSTANT_CONVERSION = YES; 176 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 177 | CLANG_WARN_EMPTY_BODY = YES; 178 | CLANG_WARN_ENUM_CONVERSION = YES; 179 | CLANG_WARN_INT_CONVERSION = YES; 180 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 181 | CLANG_WARN_UNREACHABLE_CODE = YES; 182 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 183 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 184 | COPY_PHASE_STRIP = NO; 185 | DEBUG_INFORMATION_FORMAT = dwarf; 186 | ENABLE_STRICT_OBJC_MSGSEND = YES; 187 | ENABLE_TESTABILITY = YES; 188 | GCC_C_LANGUAGE_STANDARD = gnu99; 189 | GCC_DYNAMIC_NO_PIC = NO; 190 | GCC_NO_COMMON_BLOCKS = YES; 191 | GCC_OPTIMIZATION_LEVEL = 0; 192 | GCC_PREPROCESSOR_DEFINITIONS = ( 193 | "DEBUG=1", 194 | "$(inherited)", 195 | ); 196 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 197 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 198 | GCC_WARN_UNDECLARED_SELECTOR = YES; 199 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 200 | GCC_WARN_UNUSED_FUNCTION = YES; 201 | GCC_WARN_UNUSED_VARIABLE = YES; 202 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 203 | MTL_ENABLE_DEBUG_INFO = YES; 204 | ONLY_ACTIVE_ARCH = YES; 205 | SDKROOT = iphoneos; 206 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 207 | }; 208 | name = Debug; 209 | }; 210 | 63408A2F1C8C150400C6A8B3 /* Release */ = { 211 | isa = XCBuildConfiguration; 212 | buildSettings = { 213 | ALWAYS_SEARCH_USER_PATHS = NO; 214 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 215 | CLANG_CXX_LIBRARY = "libc++"; 216 | CLANG_ENABLE_MODULES = YES; 217 | CLANG_ENABLE_OBJC_ARC = YES; 218 | CLANG_WARN_BOOL_CONVERSION = YES; 219 | CLANG_WARN_CONSTANT_CONVERSION = YES; 220 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 221 | CLANG_WARN_EMPTY_BODY = YES; 222 | CLANG_WARN_ENUM_CONVERSION = YES; 223 | CLANG_WARN_INT_CONVERSION = YES; 224 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 225 | CLANG_WARN_UNREACHABLE_CODE = YES; 226 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 227 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 228 | COPY_PHASE_STRIP = NO; 229 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 230 | ENABLE_NS_ASSERTIONS = NO; 231 | ENABLE_STRICT_OBJC_MSGSEND = YES; 232 | GCC_C_LANGUAGE_STANDARD = gnu99; 233 | GCC_NO_COMMON_BLOCKS = YES; 234 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 235 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 236 | GCC_WARN_UNDECLARED_SELECTOR = YES; 237 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 238 | GCC_WARN_UNUSED_FUNCTION = YES; 239 | GCC_WARN_UNUSED_VARIABLE = YES; 240 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 241 | MTL_ENABLE_DEBUG_INFO = NO; 242 | SDKROOT = iphoneos; 243 | VALIDATE_PRODUCT = YES; 244 | }; 245 | name = Release; 246 | }; 247 | 63408A311C8C150400C6A8B3 /* Debug */ = { 248 | isa = XCBuildConfiguration; 249 | buildSettings = { 250 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 251 | INFOPLIST_FILE = "03-ChoosePartner/Info.plist"; 252 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 253 | PRODUCT_BUNDLE_IDENTIFIER = "com.xmosh.-3-ChoosePartner"; 254 | PRODUCT_NAME = "$(TARGET_NAME)"; 255 | }; 256 | name = Debug; 257 | }; 258 | 63408A321C8C150400C6A8B3 /* Release */ = { 259 | isa = XCBuildConfiguration; 260 | buildSettings = { 261 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 262 | INFOPLIST_FILE = "03-ChoosePartner/Info.plist"; 263 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 264 | PRODUCT_BUNDLE_IDENTIFIER = "com.xmosh.-3-ChoosePartner"; 265 | PRODUCT_NAME = "$(TARGET_NAME)"; 266 | }; 267 | name = Release; 268 | }; 269 | /* End XCBuildConfiguration section */ 270 | 271 | /* Begin XCConfigurationList section */ 272 | 63408A191C8C150400C6A8B3 /* Build configuration list for PBXProject "03-ChoosePartner" */ = { 273 | isa = XCConfigurationList; 274 | buildConfigurations = ( 275 | 63408A2E1C8C150400C6A8B3 /* Debug */, 276 | 63408A2F1C8C150400C6A8B3 /* Release */, 277 | ); 278 | defaultConfigurationIsVisible = 0; 279 | defaultConfigurationName = Release; 280 | }; 281 | 63408A301C8C150400C6A8B3 /* Build configuration list for PBXNativeTarget "03-ChoosePartner" */ = { 282 | isa = XCConfigurationList; 283 | buildConfigurations = ( 284 | 63408A311C8C150400C6A8B3 /* Debug */, 285 | 63408A321C8C150400C6A8B3 /* Release */, 286 | ); 287 | defaultConfigurationIsVisible = 0; 288 | }; 289 | /* End XCConfigurationList section */ 290 | }; 291 | rootObject = 63408A161C8C150400C6A8B3 /* Project object */; 292 | } 293 | -------------------------------------------------------------------------------- /03-ChoosePartner/03-ChoosePartner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /03-ChoosePartner/03-ChoosePartner.xcodeproj/project.xcworkspace/xcuserdata/leeguoyu.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/03-ChoosePartner/03-ChoosePartner.xcodeproj/project.xcworkspace/xcuserdata/leeguoyu.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /03-ChoosePartner/03-ChoosePartner.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /03-ChoosePartner/03-ChoosePartner.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcschemes/03-ChoosePartner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /03-ChoosePartner/03-ChoosePartner.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 03-ChoosePartner.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 63408A1D1C8C150400C6A8B3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /03-ChoosePartner/03-ChoosePartner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // 03-ChoosePartner 4 | // 5 | // Created by leeguoyu on 16/3/6. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /03-ChoosePartner/03-ChoosePartner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /03-ChoosePartner/03-ChoosePartner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /03-ChoosePartner/03-ChoosePartner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 32 | 38 | 44 | 50 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /03-ChoosePartner/03-ChoosePartner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /03-ChoosePartner/03-ChoosePartner/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // 03-ChoosePartner 4 | // 5 | // Created by leeguoyu on 16/3/6. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController, UITextFieldDelegate { 12 | 13 | @IBOutlet weak var nameTextField: UITextField! 14 | @IBOutlet weak var genderOption: UISegmentedControl! 15 | @IBOutlet weak var birthdayPicker: UIDatePicker! 16 | @IBOutlet weak var heightSlider: UISlider! 17 | @IBOutlet weak var heightLabel: UILabel! 18 | @IBOutlet weak var houseSwitcher: UISwitch! 19 | @IBOutlet weak var resultTextView: UITextView! 20 | @IBOutlet weak var confirmButton: UIButton! 21 | 22 | override func viewDidLoad() { 23 | super.viewDidLoad() 24 | nameTextField.delegate = self 25 | 26 | } 27 | 28 | @IBAction func heightDidChange(sender: AnyObject) { 29 | //身高的显示 30 | heightLabel.text = "\(String(Int(heightSlider.value)))厘米" 31 | 32 | } 33 | 34 | @IBAction func confirmButtonDidClick(sender: AnyObject) { 35 | 36 | //性别 37 | let genderText = genderOption.selectedSegmentIndex == 0 ? "男" : "女" 38 | 39 | //年龄 40 | let today = NSDate() 41 | let gregorian = NSCalendar(calendarIdentifier: NSCalendarIdentifierGregorian) 42 | let component = gregorian!.components(NSCalendarUnit.Year, fromDate: birthdayPicker.date, toDate: today, options: NSCalendarOptions(rawValue: 0)) 43 | 44 | let age = component.year 45 | 46 | //是否有房 47 | let hasHouseText = houseSwitcher.on ? "有房" : "没房" 48 | 49 | //显示结果 50 | //记得要在 text 后面加 !,不然会打出来 optional 的字眼在结果里 51 | resultTextView.text = "\(nameTextField.text!), \(age)岁, \(genderText), 身高\(heightLabel.text!), \(hasHouseText)" 52 | 53 | } 54 | 55 | //TextField 代理 56 | func textFieldShouldReturn(textField: UITextField) -> Bool{ 57 | //点击 下一项 收回键盘 58 | nameTextField.resignFirstResponder() 59 | return true 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery.xcodeproj/project.xcworkspace/xcuserdata/leeguoyu.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery.xcodeproj/project.xcworkspace/xcuserdata/leeguoyu.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcschemes/04-BeautyGallery.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 04-BeautyGallery.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 6385BD421C9071F2000D5C7E 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // 04-BeautyGallery 4 | // 5 | // Created by leeguoyu on 16/3/9. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/facebook.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "facebook.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "facebook@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/facebook.imageset/facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/facebook.imageset/facebook.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/facebook.imageset/facebook@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/facebook.imageset/facebook@2x.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/fanbingbing.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "fangbingbing.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "fangbingbing@2x.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/fanbingbing.imageset/fangbingbing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/fanbingbing.imageset/fangbingbing.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/fanbingbing.imageset/fangbingbing@2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/fanbingbing.imageset/fangbingbing@2x.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/geisha.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "geisha.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "geisha@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/geisha.imageset/geisha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/geisha.imageset/geisha.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/geisha.imageset/geisha@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/geisha.imageset/geisha@2x.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/great_wall.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "great_wall.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "great_wall@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/great_wall.imageset/great_wall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/great_wall.imageset/great_wall.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/great_wall.imageset/great_wall@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/great_wall.imageset/great_wall@2x.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/japanese.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "japanese.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "japanese@2x.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/japanese.imageset/japanese.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/japanese.imageset/japanese.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/japanese.imageset/japanese@2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/japanese.imageset/japanese@2x.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/korean.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "korean.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "korean@2x.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/korean.imageset/korean.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/korean.imageset/korean.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/korean.imageset/korean@2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/korean.imageset/korean@2x.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/libingbing.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "libingbing.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "libingbing@2x.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/libingbing.imageset/libingbing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/libingbing.imageset/libingbing.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/libingbing.imageset/libingbing@2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/libingbing.imageset/libingbing@2x.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/origami.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "origami.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "origami@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/origami.imageset/origami.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/origami.imageset/origami.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/origami.imageset/origami@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/origami.imageset/origami@2x.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/torii.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "torii.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "torii@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/torii.imageset/torii.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/torii.imageset/torii.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/torii.imageset/torii@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/torii.imageset/torii@2x.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/twitter.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "twitter.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "twitter@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/twitter.imageset/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/twitter.imageset/twitter.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/twitter.imageset/twitter@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/twitter.imageset/twitter@2x.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/wangfei.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "wangfei.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "wangfei@2x.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/wangfei.imageset/wangfei.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/wangfei.imageset/wangfei.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/wangfei.imageset/wangfei@2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/wangfei.imageset/wangfei@2x.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/weibo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "weibo.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "weibo@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/weibo.imageset/weibo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/weibo.imageset/weibo.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/weibo.imageset/weibo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/weibo.imageset/weibo@2x.png -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/yangmi.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "yangmi.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "yangmi@2x.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/yangmi.imageset/yangmi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/yangmi.imageset/yangmi.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/yangmi.imageset/yangmi@2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/yangmi.imageset/yangmi@2x.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/zhouxun.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "zhouxu.jpg" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "zhouxu@2x.jpg" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/zhouxun.imageset/zhouxu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/zhouxun.imageset/zhouxu.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Assets.xcassets/zhouxun.imageset/zhouxu@2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/04-BeautyGallery/04-BeautyGallery/Assets.xcassets/zhouxun.imageset/zhouxu@2x.jpg -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/GalleryViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GalleryViewController.swift 3 | // 04-BeautyGallery 4 | // 5 | // Created by leeguoyu on 16/3/9. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Social 11 | 12 | class GalleryViewController: UIViewController { 13 | 14 | @IBOutlet weak var beautyImage: UIImageView! 15 | 16 | var imageName : String? 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | 21 | if let name = imageName{ 22 | 23 | beautyImage.image = UIImage(named: name) 24 | 25 | switch name{ 26 | case "fanbingbing": 27 | navigationItem.title = "范冰冰" 28 | 29 | case "libingbing": 30 | navigationItem.title = "李冰冰" 31 | 32 | case "wangfei": 33 | navigationItem.title = "王菲" 34 | 35 | case "yangmi": 36 | navigationItem.title = "杨幂" 37 | 38 | case "zhouxun": 39 | navigationItem.title = "周迅" 40 | 41 | default: 42 | navigationItem.title = "女神" 43 | 44 | } 45 | } 46 | 47 | } 48 | 49 | @IBAction func shareButtonDidClick(sender: AnyObject) { 50 | 51 | let controller : SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeTwitter) 52 | controller.setInitialText("玩女神相册,不是玩女神") 53 | controller.addImage(beautyImage.image) 54 | self.presentViewController(controller, animated: true, completion: nil) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/KoreanViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KoreanViewController.swift 3 | // 04-BeautyGallery 4 | // 5 | // Created by leeguoyu on 16/3/24. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Social 11 | 12 | class KoreanViewContoller : UIViewController{ 13 | 14 | @IBOutlet weak var koreanImage: UIImageView! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | } 20 | 21 | @IBAction func facebookButtonDidClick(sender: AnyObject) { 22 | 23 | let controller : SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook) 24 | controller.setInitialText("分享到Facebook") 25 | controller.addImage(koreanImage.image) 26 | self.presentViewController(controller, animated: true, completion: nil) 27 | 28 | } 29 | 30 | @IBAction func twitterButtonDidClick(sender: AnyObject) { 31 | 32 | let controller:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeTwitter) 33 | controller.setInitialText("分享到 Twitter") 34 | controller.addImage(koreanImage.image) 35 | self.presentViewController(controller, animated: true, completion: nil) 36 | } 37 | 38 | @IBAction func weiboButtonDidClick(sender: AnyObject) { 39 | 40 | // let controller:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeSinaWeibo) 41 | // controller.setInitialText("分享到微博") 42 | // controller.addImage(koreanImage.image) 43 | // self.presentViewController(controller, animated: true, completion: nil) 44 | } 45 | } -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // 04-BeautyGallery 4 | // 5 | // Created by leeguoyu on 16/3/9. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet weak var beautyPicker: UIPickerView! 14 | 15 | let beauties = ["范冰冰", "李冰冰", "王菲", "杨幂", "周迅", ] 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | beautyPicker.dataSource = self 21 | beautyPicker.delegate = self 22 | 23 | } 24 | 25 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 26 | if segue.identifier == "GoToGallery"{ 27 | 28 | let index = beautyPicker.selectedRowInComponent(0) 29 | 30 | var imageName : String? 31 | 32 | switch index{ 33 | 34 | case 0: 35 | imageName = "fanbingbing" 36 | 37 | case 1: 38 | imageName = "libingbing" 39 | 40 | case 2: 41 | imageName = "wangfei" 42 | 43 | case 3: 44 | imageName = "yangmi" 45 | 46 | case 4: 47 | imageName = "zhouxun" 48 | 49 | default: 50 | imageName = nil 51 | } 52 | 53 | let vc = segue.destinationViewController as! GalleryViewController 54 | 55 | vc.imageName = imageName 56 | } 57 | 58 | 59 | } 60 | 61 | @IBAction func close(segue: UIStoryboardSegue){ 62 | 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /04-BeautyGallery/04-BeautyGallery/ViewControllerExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewControllerExtension.swift 3 | // 04-BeautyGallery 4 | // 5 | // Created by leeguoyu on 16/3/9. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | extension ViewController : UIPickerViewDataSource{ 13 | 14 | func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int{ 15 | 16 | return 1 17 | } 18 | 19 | // returns the # of rows in each component.. 20 | func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int{ 21 | 22 | return beauties.count 23 | 24 | } 25 | } 26 | 27 | extension ViewController : UIPickerViewDelegate{ 28 | 29 | func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String?{ 30 | 31 | return beauties[row] 32 | } 33 | } -------------------------------------------------------------------------------- /05-ToDo/05-ToDo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6395E4511CA68735008776EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6395E4501CA68735008776EE /* AppDelegate.swift */; }; 11 | 6395E4531CA68735008776EE /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6395E4521CA68735008776EE /* ViewController.swift */; }; 12 | 6395E4561CA68735008776EE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6395E4541CA68735008776EE /* Main.storyboard */; }; 13 | 6395E4581CA68735008776EE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6395E4571CA68735008776EE /* Assets.xcassets */; }; 14 | 6395E45B1CA68735008776EE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6395E4591CA68735008776EE /* LaunchScreen.storyboard */; }; 15 | 6395E4631CA6A017008776EE /* TodoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6395E4621CA6A017008776EE /* TodoModel.swift */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 6395E44D1CA68734008776EE /* 05-ToDo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "05-ToDo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 6395E4501CA68735008776EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 21 | 6395E4521CA68735008776EE /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 22 | 6395E4551CA68735008776EE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 23 | 6395E4571CA68735008776EE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 24 | 6395E45A1CA68735008776EE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 25 | 6395E45C1CA68735008776EE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26 | 6395E4621CA6A017008776EE /* TodoModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TodoModel.swift; sourceTree = ""; }; 27 | /* End PBXFileReference section */ 28 | 29 | /* Begin PBXFrameworksBuildPhase section */ 30 | 6395E44A1CA68734008776EE /* Frameworks */ = { 31 | isa = PBXFrameworksBuildPhase; 32 | buildActionMask = 2147483647; 33 | files = ( 34 | ); 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXFrameworksBuildPhase section */ 38 | 39 | /* Begin PBXGroup section */ 40 | 6395E4441CA68734008776EE = { 41 | isa = PBXGroup; 42 | children = ( 43 | 6395E44F1CA68735008776EE /* 05-ToDo */, 44 | 6395E44E1CA68734008776EE /* Products */, 45 | ); 46 | sourceTree = ""; 47 | }; 48 | 6395E44E1CA68734008776EE /* Products */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | 6395E44D1CA68734008776EE /* 05-ToDo.app */, 52 | ); 53 | name = Products; 54 | sourceTree = ""; 55 | }; 56 | 6395E44F1CA68735008776EE /* 05-ToDo */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 6395E4501CA68735008776EE /* AppDelegate.swift */, 60 | 6395E4521CA68735008776EE /* ViewController.swift */, 61 | 6395E4541CA68735008776EE /* Main.storyboard */, 62 | 6395E4621CA6A017008776EE /* TodoModel.swift */, 63 | 6395E4571CA68735008776EE /* Assets.xcassets */, 64 | 6395E4591CA68735008776EE /* LaunchScreen.storyboard */, 65 | 6395E45C1CA68735008776EE /* Info.plist */, 66 | ); 67 | path = "05-ToDo"; 68 | sourceTree = ""; 69 | }; 70 | /* End PBXGroup section */ 71 | 72 | /* Begin PBXNativeTarget section */ 73 | 6395E44C1CA68734008776EE /* 05-ToDo */ = { 74 | isa = PBXNativeTarget; 75 | buildConfigurationList = 6395E45F1CA68735008776EE /* Build configuration list for PBXNativeTarget "05-ToDo" */; 76 | buildPhases = ( 77 | 6395E4491CA68734008776EE /* Sources */, 78 | 6395E44A1CA68734008776EE /* Frameworks */, 79 | 6395E44B1CA68734008776EE /* Resources */, 80 | ); 81 | buildRules = ( 82 | ); 83 | dependencies = ( 84 | ); 85 | name = "05-ToDo"; 86 | productName = "05-ToDo"; 87 | productReference = 6395E44D1CA68734008776EE /* 05-ToDo.app */; 88 | productType = "com.apple.product-type.application"; 89 | }; 90 | /* End PBXNativeTarget section */ 91 | 92 | /* Begin PBXProject section */ 93 | 6395E4451CA68734008776EE /* Project object */ = { 94 | isa = PBXProject; 95 | attributes = { 96 | LastSwiftUpdateCheck = 0730; 97 | LastUpgradeCheck = 0730; 98 | ORGANIZATIONNAME = leeguoyu; 99 | TargetAttributes = { 100 | 6395E44C1CA68734008776EE = { 101 | CreatedOnToolsVersion = 7.3; 102 | DevelopmentTeam = 5BYRRUBWU9; 103 | }; 104 | }; 105 | }; 106 | buildConfigurationList = 6395E4481CA68734008776EE /* Build configuration list for PBXProject "05-ToDo" */; 107 | compatibilityVersion = "Xcode 3.2"; 108 | developmentRegion = English; 109 | hasScannedForEncodings = 0; 110 | knownRegions = ( 111 | en, 112 | Base, 113 | ); 114 | mainGroup = 6395E4441CA68734008776EE; 115 | productRefGroup = 6395E44E1CA68734008776EE /* Products */; 116 | projectDirPath = ""; 117 | projectRoot = ""; 118 | targets = ( 119 | 6395E44C1CA68734008776EE /* 05-ToDo */, 120 | ); 121 | }; 122 | /* End PBXProject section */ 123 | 124 | /* Begin PBXResourcesBuildPhase section */ 125 | 6395E44B1CA68734008776EE /* Resources */ = { 126 | isa = PBXResourcesBuildPhase; 127 | buildActionMask = 2147483647; 128 | files = ( 129 | 6395E45B1CA68735008776EE /* LaunchScreen.storyboard in Resources */, 130 | 6395E4581CA68735008776EE /* Assets.xcassets in Resources */, 131 | 6395E4561CA68735008776EE /* Main.storyboard in Resources */, 132 | ); 133 | runOnlyForDeploymentPostprocessing = 0; 134 | }; 135 | /* End PBXResourcesBuildPhase section */ 136 | 137 | /* Begin PBXSourcesBuildPhase section */ 138 | 6395E4491CA68734008776EE /* Sources */ = { 139 | isa = PBXSourcesBuildPhase; 140 | buildActionMask = 2147483647; 141 | files = ( 142 | 6395E4631CA6A017008776EE /* TodoModel.swift in Sources */, 143 | 6395E4531CA68735008776EE /* ViewController.swift in Sources */, 144 | 6395E4511CA68735008776EE /* AppDelegate.swift in Sources */, 145 | ); 146 | runOnlyForDeploymentPostprocessing = 0; 147 | }; 148 | /* End PBXSourcesBuildPhase section */ 149 | 150 | /* Begin PBXVariantGroup section */ 151 | 6395E4541CA68735008776EE /* Main.storyboard */ = { 152 | isa = PBXVariantGroup; 153 | children = ( 154 | 6395E4551CA68735008776EE /* Base */, 155 | ); 156 | name = Main.storyboard; 157 | sourceTree = ""; 158 | }; 159 | 6395E4591CA68735008776EE /* LaunchScreen.storyboard */ = { 160 | isa = PBXVariantGroup; 161 | children = ( 162 | 6395E45A1CA68735008776EE /* Base */, 163 | ); 164 | name = LaunchScreen.storyboard; 165 | sourceTree = ""; 166 | }; 167 | /* End PBXVariantGroup section */ 168 | 169 | /* Begin XCBuildConfiguration section */ 170 | 6395E45D1CA68735008776EE /* Debug */ = { 171 | isa = XCBuildConfiguration; 172 | buildSettings = { 173 | ALWAYS_SEARCH_USER_PATHS = NO; 174 | CLANG_ANALYZER_NONNULL = YES; 175 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 176 | CLANG_CXX_LIBRARY = "libc++"; 177 | CLANG_ENABLE_MODULES = YES; 178 | CLANG_ENABLE_OBJC_ARC = YES; 179 | CLANG_WARN_BOOL_CONVERSION = YES; 180 | CLANG_WARN_CONSTANT_CONVERSION = YES; 181 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 182 | CLANG_WARN_EMPTY_BODY = YES; 183 | CLANG_WARN_ENUM_CONVERSION = YES; 184 | CLANG_WARN_INT_CONVERSION = YES; 185 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 186 | CLANG_WARN_UNREACHABLE_CODE = YES; 187 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 188 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 189 | COPY_PHASE_STRIP = NO; 190 | DEBUG_INFORMATION_FORMAT = dwarf; 191 | ENABLE_STRICT_OBJC_MSGSEND = YES; 192 | ENABLE_TESTABILITY = YES; 193 | GCC_C_LANGUAGE_STANDARD = gnu99; 194 | GCC_DYNAMIC_NO_PIC = NO; 195 | GCC_NO_COMMON_BLOCKS = YES; 196 | GCC_OPTIMIZATION_LEVEL = 0; 197 | GCC_PREPROCESSOR_DEFINITIONS = ( 198 | "DEBUG=1", 199 | "$(inherited)", 200 | ); 201 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 202 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 203 | GCC_WARN_UNDECLARED_SELECTOR = YES; 204 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 205 | GCC_WARN_UNUSED_FUNCTION = YES; 206 | GCC_WARN_UNUSED_VARIABLE = YES; 207 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 208 | MTL_ENABLE_DEBUG_INFO = YES; 209 | ONLY_ACTIVE_ARCH = YES; 210 | SDKROOT = iphoneos; 211 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 212 | }; 213 | name = Debug; 214 | }; 215 | 6395E45E1CA68735008776EE /* Release */ = { 216 | isa = XCBuildConfiguration; 217 | buildSettings = { 218 | ALWAYS_SEARCH_USER_PATHS = NO; 219 | CLANG_ANALYZER_NONNULL = YES; 220 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 221 | CLANG_CXX_LIBRARY = "libc++"; 222 | CLANG_ENABLE_MODULES = YES; 223 | CLANG_ENABLE_OBJC_ARC = YES; 224 | CLANG_WARN_BOOL_CONVERSION = YES; 225 | CLANG_WARN_CONSTANT_CONVERSION = YES; 226 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 227 | CLANG_WARN_EMPTY_BODY = YES; 228 | CLANG_WARN_ENUM_CONVERSION = YES; 229 | CLANG_WARN_INT_CONVERSION = YES; 230 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 231 | CLANG_WARN_UNREACHABLE_CODE = YES; 232 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 233 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 234 | COPY_PHASE_STRIP = NO; 235 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 236 | ENABLE_NS_ASSERTIONS = NO; 237 | ENABLE_STRICT_OBJC_MSGSEND = YES; 238 | GCC_C_LANGUAGE_STANDARD = gnu99; 239 | GCC_NO_COMMON_BLOCKS = YES; 240 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 241 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 242 | GCC_WARN_UNDECLARED_SELECTOR = YES; 243 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 244 | GCC_WARN_UNUSED_FUNCTION = YES; 245 | GCC_WARN_UNUSED_VARIABLE = YES; 246 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 247 | MTL_ENABLE_DEBUG_INFO = NO; 248 | SDKROOT = iphoneos; 249 | VALIDATE_PRODUCT = YES; 250 | }; 251 | name = Release; 252 | }; 253 | 6395E4601CA68735008776EE /* Debug */ = { 254 | isa = XCBuildConfiguration; 255 | buildSettings = { 256 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 257 | CODE_SIGN_IDENTITY = "iPhone Developer"; 258 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 259 | INFOPLIST_FILE = "05-ToDo/Info.plist"; 260 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 261 | PRODUCT_BUNDLE_IDENTIFIER = "com.xmosh.-5-ToDo"; 262 | PRODUCT_NAME = "$(TARGET_NAME)"; 263 | PROVISIONING_PROFILE = ""; 264 | }; 265 | name = Debug; 266 | }; 267 | 6395E4611CA68735008776EE /* Release */ = { 268 | isa = XCBuildConfiguration; 269 | buildSettings = { 270 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 271 | CODE_SIGN_IDENTITY = "iPhone Developer"; 272 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 273 | INFOPLIST_FILE = "05-ToDo/Info.plist"; 274 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 275 | PRODUCT_BUNDLE_IDENTIFIER = "com.xmosh.-5-ToDo"; 276 | PRODUCT_NAME = "$(TARGET_NAME)"; 277 | PROVISIONING_PROFILE = ""; 278 | }; 279 | name = Release; 280 | }; 281 | /* End XCBuildConfiguration section */ 282 | 283 | /* Begin XCConfigurationList section */ 284 | 6395E4481CA68734008776EE /* Build configuration list for PBXProject "05-ToDo" */ = { 285 | isa = XCConfigurationList; 286 | buildConfigurations = ( 287 | 6395E45D1CA68735008776EE /* Debug */, 288 | 6395E45E1CA68735008776EE /* Release */, 289 | ); 290 | defaultConfigurationIsVisible = 0; 291 | defaultConfigurationName = Release; 292 | }; 293 | 6395E45F1CA68735008776EE /* Build configuration list for PBXNativeTarget "05-ToDo" */ = { 294 | isa = XCConfigurationList; 295 | buildConfigurations = ( 296 | 6395E4601CA68735008776EE /* Debug */, 297 | 6395E4611CA68735008776EE /* Release */, 298 | ); 299 | defaultConfigurationIsVisible = 0; 300 | }; 301 | /* End XCConfigurationList section */ 302 | }; 303 | rootObject = 6395E4451CA68734008776EE /* Project object */; 304 | } 305 | -------------------------------------------------------------------------------- /05-ToDo/05-ToDo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /05-ToDo/05-ToDo.xcodeproj/project.xcworkspace/xcuserdata/leeguoyu.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo.xcodeproj/project.xcworkspace/xcuserdata/leeguoyu.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /05-ToDo/05-ToDo.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /05-ToDo/05-ToDo.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcschemes/05-ToDo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /05-ToDo/05-ToDo.xcodeproj/xcuserdata/leeguoyu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 05-ToDo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 6395E44C1CA68734008776EE 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // 05-ToDo 4 | // 5 | // Created by leeguoyu on 16/3/26. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/child-selected.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "child-selected.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "child-selected@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "child-selected@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/child-selected.imageset/child-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/child-selected.imageset/child-selected.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/child-selected.imageset/child-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/child-selected.imageset/child-selected@2x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/child-selected.imageset/child-selected@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/child-selected.imageset/child-selected@3x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/child.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "child.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "child@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "child@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/child.imageset/child.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/child.imageset/child.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/child.imageset/child@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/child.imageset/child@2x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/child.imageset/child@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/child.imageset/child@3x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/phone-selected.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "phone-selected.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "phone-selected@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "phone-selected@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/phone-selected.imageset/phone-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/phone-selected.imageset/phone-selected.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/phone-selected.imageset/phone-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/phone-selected.imageset/phone-selected@2x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/phone-selected.imageset/phone-selected@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/phone-selected.imageset/phone-selected@3x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/phone.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "phone.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "phone@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "phone@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/phone.imageset/phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/phone.imageset/phone.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/phone.imageset/phone@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/phone.imageset/phone@2x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/phone.imageset/phone@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/phone.imageset/phone@3x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/shopping-cart-selected.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "shopping-cart-selected.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "shopping-cart-selected@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "shopping-cart-selected@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/shopping-cart-selected.imageset/shopping-cart-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/shopping-cart-selected.imageset/shopping-cart-selected.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/shopping-cart-selected.imageset/shopping-cart-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/shopping-cart-selected.imageset/shopping-cart-selected@2x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/shopping-cart-selected.imageset/shopping-cart-selected@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/shopping-cart-selected.imageset/shopping-cart-selected@3x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/shopping-cart.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "shopping-cart.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "shopping-cart@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "shopping-cart@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/shopping-cart.imageset/shopping-cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/shopping-cart.imageset/shopping-cart.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/shopping-cart.imageset/shopping-cart@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/shopping-cart.imageset/shopping-cart@2x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/shopping-cart.imageset/shopping-cart@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/shopping-cart.imageset/shopping-cart@3x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/travel-selected.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "travel-selected.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "travel-selected@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "travel-selected@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/travel-selected.imageset/travel-selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/travel-selected.imageset/travel-selected.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/travel-selected.imageset/travel-selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/travel-selected.imageset/travel-selected@2x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/travel-selected.imageset/travel-selected@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/travel-selected.imageset/travel-selected@3x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/travel.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "travel.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "travel@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "travel@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/travel.imageset/travel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/travel.imageset/travel.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/travel.imageset/travel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/travel.imageset/travel@2x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Assets.xcassets/travel.imageset/travel@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leeguoyu/30-Swift-Practices/e8ac918ff47a5c6c512463f88bc24eb3ad636d6a/05-ToDo/05-ToDo/Assets.xcassets/travel.imageset/travel@3x.png -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 76 | 80 | 84 | 88 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/TodoModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodoModel.swift 3 | // 05-ToDo 4 | // 5 | // Created by leeguoyu on 16/3/26. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TodoModel: NSObject { 12 | 13 | var id: String 14 | var image: String 15 | var title: String 16 | var date: NSDate 17 | 18 | init(id: String, image: String, title: String, date: NSDate) { 19 | self.id = id 20 | self.image = image 21 | self.title = title 22 | self.date = date 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /05-ToDo/05-ToDo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // 05-ToDo 4 | // 5 | // Created by leeguoyu on 16/3/26. 6 | // Copyright © 2016年 leeguoyu. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | var todos: [TodoModel] = [] 12 | 13 | func dateFromString(dateStr: String) -> NSDate? { 14 | let dateFormatter = NSDateFormatter() 15 | dateFormatter.dateFormat = "yyyy-MM-dd" 16 | let date = dateFormatter.dateFromString(dateStr) 17 | return date 18 | } 19 | 20 | class ViewController: UITableViewController{ 21 | 22 | override func viewDidLoad() { 23 | super.viewDidLoad() 24 | 25 | todos = [TodoModel(id: "1", image: "child-selected", title: "去游乐场", date: dateFromString("2016-03-25")!), TodoModel(id: "2", image: "shopping-cart-selected", title: "去购物", date: dateFromString("2016-04-25")!), TodoModel(id: "3", image: "phone-selected", title: "打电话", date: dateFromString("2016-05-25")!), TodoModel(id: "4", image: "travel-selected", title: "去旅行", date: dateFromString("2016-05-25")!)] 26 | 27 | //Edit按钮 28 | navigationItem.leftBarButtonItem = editButtonItem() 29 | 30 | } 31 | 32 | 33 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 34 | return todos.count 35 | } 36 | 37 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 38 | let cell = self.tableView.dequeueReusableCellWithIdentifier("todoCell")! as UITableViewCell 39 | 40 | let todo = todos[indexPath.row] as TodoModel 41 | 42 | //设置图片 43 | let image = cell.viewWithTag(101) as! UIImageView 44 | image.image = UIImage(named: todo.image) 45 | 46 | //设置标题 47 | let title = cell.viewWithTag(102) as! UILabel 48 | title.text = todo.title 49 | 50 | //设置日期 51 | //注意 yyyy-MM-dd 一定要注意区分大小写,不然出来结果有异 52 | let dateFormatter = NSDateFormatter() 53 | dateFormatter.dateFormat = NSDateFormatter.dateFormatFromTemplate("yyyy-MM-dd", options: 0, locale: NSLocale.currentLocale()) 54 | 55 | 56 | let date = cell.viewWithTag(103) as! UILabel 57 | date.text = dateFormatter.stringFromDate(todo.date) 58 | 59 | return cell 60 | } 61 | 62 | //删除单元格 63 | override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { 64 | if editingStyle == UITableViewCellEditingStyle.Delete{ 65 | todos.removeAtIndex(indexPath.row) 66 | // self.tableView.reloadData() 67 | //动画 68 | self.tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Automatic) 69 | } 70 | } 71 | 72 | //左上角Edit按钮事件(不能用true来做布尔值) 73 | override func setEditing(editing: Bool, animated: Bool) { 74 | super.setEditing(editing, animated: animated) 75 | self.tableView.setEditing(editing, animated: animated) 76 | } 77 | 78 | } 79 | 80 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 30-Swift-Practices 2 | 3 | 给自己立个flag: 4 | 从2月29号开始,学习 [@Allen朝辉](http://weibo.com/ttarticle/p/show?id=2309403942494873235448),30天每天一个Swift Demo。 5 | 6 | ##01-StopWatch 计时器 7 | 8 | ####2月29号 9 | 今晚本想洗完澡神清气爽地开工,结果拉了三次肚子。洗完澡才拉肚子,这是谁在诅咒我么?!能把 flag 拔了么?犹豫中…… 10 | 元气大恢复!好歹是把StopWatch给画出来了。代码,明天见! 11 | 12 | ####3月1号 13 | 赶文章,写不了代码。你看现在是什么时间就知道我并没有偷懒~ 14 | 15 | ####3月2号 16 | 今天的工作任务主要是写了篇长文,绞尽了脑汁。回家后不知为啥就鬼使神差地点开了卧虎藏龙2,看了一半看不下去了才想起要写代码……也算是set了个counter吧。 17 | 18 | ####3月3号 19 | 完成咯,简单的计时器。等以后学到数据持久化,再完善吧。顺带发现 Allen 的方法比较曲线救国,其实调用按钮的 `.enabled` 属性就好了。 20 | 21 | ##02-ChineseHoroscope 12生肖 22 | 23 | ####3月4 & 5号 24 | 4号是周五,所以跑去打火锅以及看了 叶问33D 午夜场。自从看过《师父》,对于这种功夫片是再也回不去了,何况威亚吊的还这么明显。 25 | 26 | 今天完成了 [JakeLin](https://github.com/JakeLin/) 大神的「12生肖」,非常简单的一个demo。发现一个 Swift 2.0 已经不用的语法: 27 | 28 | ```objc 29 | TextField.text.toInt() 30 | ``` 31 | Swift 2.0 里已变成了 32 | 33 | ```objc 34 | if let year : Int = Int(yearTextField.text!){ 35 | ``` 36 | ##03-ChoosePartner 相亲神器 37 | 38 | ####3月6号 39 | 完成了 JakeLin 的另一个 demo,熟悉了一些控件的基本用法。更主要的收获是掌握了搜索StackOverFlow的一些窍门,成功找到了另一个Swift 2里 `NSCalendarUnit` 已被废掉的用法。 40 | 41 | ####3月7号 42 | 下班前尝试着安装CocoaPods。碰到了两个问题,一是一些教程里提到可以把原版下载地址换成淘宝镜像,速度会更快。淘宝镜像已换成`https`了,新地址是`https://ruby.taobao.org`。二是 El Capitan 在安装时可能会出现 43 | 44 | `ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/pod` 45 | 46 | 的错误,这时需要把安装命令改为 47 | 48 | `sudo gem install -n /usr/local/bin cocoapods` 49 | 50 | ##04-BeautyGallery 女神相册 51 | 52 | ####3月9号 53 | 54 | 昨天也是赶文章破了功。今天这个项目主要是了解 `UIPickerView` 的使用以及界面间传值。学完对数组的使用更加清晰,只是目前的疑问是:row 的选择使用了switch来判断,但感觉这样写效率比较低,特别是当需要处理网络数据时,row 的数量以及选项的 title 应该都是不确定,无法写死的。有待继续学习。 55 | 56 | ####3月10号~14号 57 | 58 | 最近被好几篇文章搞得不想再看代码了怎么办!周末还有个采访要准备!!!Omnifocus 为什么不能帮到我!!! 59 | 60 | ####3月15号 61 | 62 | 为女神相册加入了导航栏和分享功能,实测三行代码能一键分享成功。但对于用`Switch`来做判断的偷懒做法耿耿于怀。得再找时间完善。 63 | 64 | ####3月24号 65 | 66 | 本以为只是偷懒了一两天,没想到已经快十天了~~~好惭愧! 67 | 68 | 今天给女神相册加入了 tabbar 和分享功能。用SB来做界面真的很方便。 69 | 70 | ####3月26号 71 | 72 | 学习了AutoLayout,原来没有想象中的那么复杂。 73 | 74 | ##05-ToDo 75 | 76 | ####3月26号 77 | 78 | 创建了能初步显示图标、标题、日期的ToDo,学习了: 79 | 80 | 1. 创建数据Model 81 | 2. 自定义cell 82 | 3. 设置`dateFormatter` 83 | 84 | ####3月29号 85 | 86 | 本来想说因为有一个完整的项目要做,估计得花多点时间在 OC 那边,Swift 得暂停,但没想到已经开始有人在 star 了……所以,我还是会争取边 OC 边 Swift 的!!! 87 | 88 | OC 项目是做这个:https://github.com/leeguoyu/BaiSiBuDeJie 89 | 90 | --------------------------------------------------------------------------------