├── .gitignore ├── Huahui.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── Huahui ├── .DS_Store ├── AppDelegate.swift ├── Assets.xcassets │ ├── .DS_Store │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-57x57@1x.png │ │ ├── Icon-App-57x57@2x.png │ │ ├── Icon-App-57x57@3x.png │ │ ├── Icon-App-60x60@1x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ ├── Icon-App-76x76@3x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── Contents.json ├── Base.lproj │ └── LaunchScreen.storyboard ├── Info.plist ├── Model │ ├── Word.swift │ └── Words.swift ├── View │ ├── WordCell.swift │ └── WordListHeader.swift └── WordsList.swift ├── Makefile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/xcode,appcode,swift,osx 3 | 4 | ### AppCode ### 5 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 6 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 7 | 8 | # User-specific stuff: 9 | .idea/**/workspace.xml 10 | .idea/**/tasks.xml 11 | 12 | # Sensitive or high-churn files: 13 | .idea/**/dataSources/ 14 | .idea/**/dataSources.ids 15 | .idea/**/dataSources.xml 16 | .idea/**/dataSources.local.xml 17 | .idea/**/sqlDataSources.xml 18 | .idea/**/dynamic.xml 19 | .idea/**/uiDesigner.xml 20 | 21 | # Gradle: 22 | .idea/**/gradle.xml 23 | .idea/**/libraries 24 | 25 | # Mongo Explorer plugin: 26 | .idea/**/mongoSettings.xml 27 | 28 | ## File-based project format: 29 | *.iws 30 | 31 | ## Plugin-specific files: 32 | 33 | # IntelliJ 34 | /out/ 35 | 36 | # mpeltonen/sbt-idea plugin 37 | .idea_modules/ 38 | 39 | # JIRA plugin 40 | atlassian-ide-plugin.xml 41 | 42 | # Crashlytics plugin (for Android Studio and IntelliJ) 43 | com_crashlytics_export_strings.xml 44 | crashlytics.properties 45 | crashlytics-build.properties 46 | fabric.properties 47 | 48 | ### AppCode Patch ### 49 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 50 | 51 | # *.iml 52 | # modules.xml 53 | # .idea/misc.xml 54 | # *.ipr 55 | 56 | ### OSX ### 57 | *.DS_Store 58 | .AppleDouble 59 | .LSOverride 60 | 61 | # Icon must end with two \r 62 | Icon 63 | 64 | 65 | # Thumbnails 66 | ._* 67 | 68 | # Files that might appear in the root of a volume 69 | .DocumentRevisions-V100 70 | .fseventsd 71 | .Spotlight-V100 72 | .TemporaryItems 73 | .Trashes 74 | .VolumeIcon.icns 75 | .com.apple.timemachine.donotpresent 76 | 77 | # Directories potentially created on remote AFP share 78 | .AppleDB 79 | .AppleDesktop 80 | Network Trash Folder 81 | Temporary Items 82 | .apdisk 83 | 84 | ### Swift ### 85 | # Xcode 86 | # 87 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 88 | 89 | ## Build generated 90 | build/ 91 | DerivedData/ 92 | 93 | ## Various settings 94 | *.pbxuser 95 | !default.pbxuser 96 | *.mode1v3 97 | !default.mode1v3 98 | *.mode2v3 99 | !default.mode2v3 100 | *.perspectivev3 101 | !default.perspectivev3 102 | xcuserdata/ 103 | 104 | ## Other 105 | *.moved-aside 106 | *.xccheckout 107 | *.xcscmblueprint 108 | 109 | ## Obj-C/Swift specific 110 | *.hmap 111 | *.ipa 112 | *.dSYM.zip 113 | *.dSYM 114 | 115 | ## Playgrounds 116 | timeline.xctimeline 117 | playground.xcworkspace 118 | 119 | # Swift Package Manager 120 | # 121 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 122 | # Packages/ 123 | # Package.pins 124 | .build/ 125 | 126 | # CocoaPods 127 | # 128 | # We recommend against adding the Pods directory to your .gitignore. However 129 | # you should judge for yourself, the pros and cons are mentioned at: 130 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 131 | # 132 | # Pods/ 133 | 134 | # Carthage 135 | # 136 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 137 | # Carthage/Checkouts 138 | 139 | Carthage/Build 140 | 141 | # fastlane 142 | # 143 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 144 | # screenshots whenever they are needed. 145 | # For more information about the recommended setup visit: 146 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 147 | 148 | fastlane/report.xml 149 | fastlane/Preview.html 150 | fastlane/screenshots 151 | fastlane/test_output 152 | 153 | ### Xcode ### 154 | build 155 | *.xcodeproj/* 156 | !*.xcodeproj/project.pbxproj 157 | !*.xcworkspace/contents.xcworkspacedata 158 | /*.gcno 159 | 160 | # End of https://www.gitignore.io/api/xcode,appcode,swift,osx 161 | -------------------------------------------------------------------------------- /Huahui.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D7B95A1D1E63096E0059C57D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B95A1C1E63096E0059C57D /* AppDelegate.swift */; }; 11 | D7B95A261E63096E0059C57D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D7B95A251E63096E0059C57D /* Assets.xcassets */; }; 12 | D7B95A291E63096E0059C57D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D7B95A271E63096E0059C57D /* LaunchScreen.storyboard */; }; 13 | D7B95A331E6310970059C57D /* WordsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B95A321E6310970059C57D /* WordsList.swift */; }; 14 | D7B95A3E1E65AD830059C57D /* Word.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B95A3B1E65AD830059C57D /* Word.swift */; }; 15 | D7B95A3F1E65AD830059C57D /* WordCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B95A3D1E65AD830059C57D /* WordCell.swift */; }; 16 | D7B95A411E65ADBA0059C57D /* WordListHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B95A401E65ADBA0059C57D /* WordListHeader.swift */; }; 17 | D7B95A431E66FD560059C57D /* Words.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B95A421E66FD560059C57D /* Words.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | D7B95A191E63096E0059C57D /* Huahui.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Huahui.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | D7B95A1C1E63096E0059C57D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | D7B95A251E63096E0059C57D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 24 | D7B95A281E63096E0059C57D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 25 | D7B95A2A1E63096E0059C57D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26 | D7B95A321E6310970059C57D /* WordsList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WordsList.swift; sourceTree = ""; }; 27 | D7B95A3B1E65AD830059C57D /* Word.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Word.swift; sourceTree = ""; }; 28 | D7B95A3D1E65AD830059C57D /* WordCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WordCell.swift; sourceTree = ""; }; 29 | D7B95A401E65ADBA0059C57D /* WordListHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WordListHeader.swift; sourceTree = ""; }; 30 | D7B95A421E66FD560059C57D /* Words.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Words.swift; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | D7B95A161E63096E0059C57D /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | D7B95A101E63096E0059C57D = { 45 | isa = PBXGroup; 46 | children = ( 47 | D7B95A1B1E63096E0059C57D /* Huahui */, 48 | D7B95A1A1E63096E0059C57D /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | D7B95A1A1E63096E0059C57D /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | D7B95A191E63096E0059C57D /* Huahui.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | D7B95A1B1E63096E0059C57D /* Huahui */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | D7B95A1C1E63096E0059C57D /* AppDelegate.swift */, 64 | D7B95A321E6310970059C57D /* WordsList.swift */, 65 | D7B95A3A1E65AD830059C57D /* Model */, 66 | D7B95A3C1E65AD830059C57D /* View */, 67 | D7B95A271E63096E0059C57D /* LaunchScreen.storyboard */, 68 | D7B95A251E63096E0059C57D /* Assets.xcassets */, 69 | D7B95A2A1E63096E0059C57D /* Info.plist */, 70 | ); 71 | path = Huahui; 72 | sourceTree = ""; 73 | }; 74 | D7B95A3A1E65AD830059C57D /* Model */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | D7B95A3B1E65AD830059C57D /* Word.swift */, 78 | D7B95A421E66FD560059C57D /* Words.swift */, 79 | ); 80 | path = Model; 81 | sourceTree = ""; 82 | }; 83 | D7B95A3C1E65AD830059C57D /* View */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | D7B95A3D1E65AD830059C57D /* WordCell.swift */, 87 | D7B95A401E65ADBA0059C57D /* WordListHeader.swift */, 88 | ); 89 | path = View; 90 | sourceTree = ""; 91 | }; 92 | /* End PBXGroup section */ 93 | 94 | /* Begin PBXNativeTarget section */ 95 | D7B95A181E63096E0059C57D /* Huahui */ = { 96 | isa = PBXNativeTarget; 97 | buildConfigurationList = D7B95A2D1E63096E0059C57D /* Build configuration list for PBXNativeTarget "Huahui" */; 98 | buildPhases = ( 99 | D7B95A151E63096E0059C57D /* Sources */, 100 | D7B95A161E63096E0059C57D /* Frameworks */, 101 | D7B95A171E63096E0059C57D /* Resources */, 102 | ); 103 | buildRules = ( 104 | ); 105 | dependencies = ( 106 | ); 107 | name = Huahui; 108 | productName = Huahui; 109 | productReference = D7B95A191E63096E0059C57D /* Huahui.app */; 110 | productType = "com.apple.product-type.application"; 111 | }; 112 | /* End PBXNativeTarget section */ 113 | 114 | /* Begin PBXProject section */ 115 | D7B95A111E63096E0059C57D /* Project object */ = { 116 | isa = PBXProject; 117 | attributes = { 118 | LastSwiftUpdateCheck = 0820; 119 | LastUpgradeCheck = 0820; 120 | ORGANIZATIONNAME = lexrus.com; 121 | TargetAttributes = { 122 | D7B95A181E63096E0059C57D = { 123 | CreatedOnToolsVersion = 8.2.1; 124 | DevelopmentTeam = U3RP6NYT4P; 125 | ProvisioningStyle = Automatic; 126 | }; 127 | }; 128 | }; 129 | buildConfigurationList = D7B95A141E63096E0059C57D /* Build configuration list for PBXProject "Huahui" */; 130 | compatibilityVersion = "Xcode 3.2"; 131 | developmentRegion = English; 132 | hasScannedForEncodings = 0; 133 | knownRegions = ( 134 | en, 135 | Base, 136 | ); 137 | mainGroup = D7B95A101E63096E0059C57D; 138 | productRefGroup = D7B95A1A1E63096E0059C57D /* Products */; 139 | projectDirPath = ""; 140 | projectRoot = ""; 141 | targets = ( 142 | D7B95A181E63096E0059C57D /* Huahui */, 143 | ); 144 | }; 145 | /* End PBXProject section */ 146 | 147 | /* Begin PBXResourcesBuildPhase section */ 148 | D7B95A171E63096E0059C57D /* Resources */ = { 149 | isa = PBXResourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | D7B95A291E63096E0059C57D /* LaunchScreen.storyboard in Resources */, 153 | D7B95A261E63096E0059C57D /* Assets.xcassets in Resources */, 154 | ); 155 | runOnlyForDeploymentPostprocessing = 0; 156 | }; 157 | /* End PBXResourcesBuildPhase section */ 158 | 159 | /* Begin PBXSourcesBuildPhase section */ 160 | D7B95A151E63096E0059C57D /* Sources */ = { 161 | isa = PBXSourcesBuildPhase; 162 | buildActionMask = 2147483647; 163 | files = ( 164 | D7B95A1D1E63096E0059C57D /* AppDelegate.swift in Sources */, 165 | D7B95A3E1E65AD830059C57D /* Word.swift in Sources */, 166 | D7B95A3F1E65AD830059C57D /* WordCell.swift in Sources */, 167 | D7B95A431E66FD560059C57D /* Words.swift in Sources */, 168 | D7B95A411E65ADBA0059C57D /* WordListHeader.swift in Sources */, 169 | D7B95A331E6310970059C57D /* WordsList.swift in Sources */, 170 | ); 171 | runOnlyForDeploymentPostprocessing = 0; 172 | }; 173 | /* End PBXSourcesBuildPhase section */ 174 | 175 | /* Begin PBXVariantGroup section */ 176 | D7B95A271E63096E0059C57D /* LaunchScreen.storyboard */ = { 177 | isa = PBXVariantGroup; 178 | children = ( 179 | D7B95A281E63096E0059C57D /* Base */, 180 | ); 181 | name = LaunchScreen.storyboard; 182 | sourceTree = ""; 183 | }; 184 | /* End PBXVariantGroup section */ 185 | 186 | /* Begin XCBuildConfiguration section */ 187 | D7B95A2B1E63096E0059C57D /* Debug */ = { 188 | isa = XCBuildConfiguration; 189 | buildSettings = { 190 | ALWAYS_SEARCH_USER_PATHS = NO; 191 | CLANG_ANALYZER_NONNULL = YES; 192 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 193 | CLANG_CXX_LIBRARY = "libc++"; 194 | CLANG_ENABLE_MODULES = YES; 195 | CLANG_ENABLE_OBJC_ARC = YES; 196 | CLANG_WARN_BOOL_CONVERSION = YES; 197 | CLANG_WARN_CONSTANT_CONVERSION = YES; 198 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 199 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 200 | CLANG_WARN_EMPTY_BODY = YES; 201 | CLANG_WARN_ENUM_CONVERSION = YES; 202 | CLANG_WARN_INFINITE_RECURSION = YES; 203 | CLANG_WARN_INT_CONVERSION = YES; 204 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 205 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 206 | CLANG_WARN_UNREACHABLE_CODE = YES; 207 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 208 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 209 | COPY_PHASE_STRIP = NO; 210 | DEBUG_INFORMATION_FORMAT = dwarf; 211 | ENABLE_STRICT_OBJC_MSGSEND = YES; 212 | ENABLE_TESTABILITY = YES; 213 | GCC_C_LANGUAGE_STANDARD = gnu99; 214 | GCC_DYNAMIC_NO_PIC = NO; 215 | GCC_NO_COMMON_BLOCKS = YES; 216 | GCC_OPTIMIZATION_LEVEL = 0; 217 | GCC_PREPROCESSOR_DEFINITIONS = ( 218 | "DEBUG=1", 219 | "$(inherited)", 220 | ); 221 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 222 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 223 | GCC_WARN_UNDECLARED_SELECTOR = YES; 224 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 225 | GCC_WARN_UNUSED_FUNCTION = YES; 226 | GCC_WARN_UNUSED_VARIABLE = YES; 227 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 228 | MTL_ENABLE_DEBUG_INFO = YES; 229 | ONLY_ACTIVE_ARCH = YES; 230 | SDKROOT = iphoneos; 231 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 232 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 233 | }; 234 | name = Debug; 235 | }; 236 | D7B95A2C1E63096E0059C57D /* Release */ = { 237 | isa = XCBuildConfiguration; 238 | buildSettings = { 239 | ALWAYS_SEARCH_USER_PATHS = NO; 240 | CLANG_ANALYZER_NONNULL = YES; 241 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 242 | CLANG_CXX_LIBRARY = "libc++"; 243 | CLANG_ENABLE_MODULES = YES; 244 | CLANG_ENABLE_OBJC_ARC = YES; 245 | CLANG_WARN_BOOL_CONVERSION = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 248 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 254 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 255 | CLANG_WARN_UNREACHABLE_CODE = YES; 256 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 257 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 258 | COPY_PHASE_STRIP = NO; 259 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 260 | ENABLE_NS_ASSERTIONS = NO; 261 | ENABLE_STRICT_OBJC_MSGSEND = YES; 262 | GCC_C_LANGUAGE_STANDARD = gnu99; 263 | GCC_NO_COMMON_BLOCKS = YES; 264 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 265 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 266 | GCC_WARN_UNDECLARED_SELECTOR = YES; 267 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 268 | GCC_WARN_UNUSED_FUNCTION = YES; 269 | GCC_WARN_UNUSED_VARIABLE = YES; 270 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 271 | MTL_ENABLE_DEBUG_INFO = NO; 272 | SDKROOT = iphoneos; 273 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 274 | VALIDATE_PRODUCT = YES; 275 | }; 276 | name = Release; 277 | }; 278 | D7B95A2E1E63096E0059C57D /* Debug */ = { 279 | isa = XCBuildConfiguration; 280 | buildSettings = { 281 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 282 | DEVELOPMENT_TEAM = U3RP6NYT4P; 283 | INFOPLIST_FILE = Huahui/Info.plist; 284 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 285 | PRODUCT_BUNDLE_IDENTIFIER = com.LexTang.Huahui; 286 | PRODUCT_NAME = "$(TARGET_NAME)"; 287 | SWIFT_VERSION = 3.0; 288 | TARGETED_DEVICE_FAMILY = "1,2"; 289 | }; 290 | name = Debug; 291 | }; 292 | D7B95A2F1E63096E0059C57D /* Release */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 296 | DEVELOPMENT_TEAM = U3RP6NYT4P; 297 | INFOPLIST_FILE = Huahui/Info.plist; 298 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 299 | PRODUCT_BUNDLE_IDENTIFIER = com.LexTang.Huahui; 300 | PRODUCT_NAME = "$(TARGET_NAME)"; 301 | SWIFT_VERSION = 3.0; 302 | TARGETED_DEVICE_FAMILY = "1,2"; 303 | }; 304 | name = Release; 305 | }; 306 | /* End XCBuildConfiguration section */ 307 | 308 | /* Begin XCConfigurationList section */ 309 | D7B95A141E63096E0059C57D /* Build configuration list for PBXProject "Huahui" */ = { 310 | isa = XCConfigurationList; 311 | buildConfigurations = ( 312 | D7B95A2B1E63096E0059C57D /* Debug */, 313 | D7B95A2C1E63096E0059C57D /* Release */, 314 | ); 315 | defaultConfigurationIsVisible = 0; 316 | defaultConfigurationName = Release; 317 | }; 318 | D7B95A2D1E63096E0059C57D /* Build configuration list for PBXNativeTarget "Huahui" */ = { 319 | isa = XCConfigurationList; 320 | buildConfigurations = ( 321 | D7B95A2E1E63096E0059C57D /* Debug */, 322 | D7B95A2F1E63096E0059C57D /* Release */, 323 | ); 324 | defaultConfigurationIsVisible = 0; 325 | defaultConfigurationName = Release; 326 | }; 327 | /* End XCConfigurationList section */ 328 | }; 329 | rootObject = D7B95A111E63096E0059C57D /* Project object */; 330 | } 331 | -------------------------------------------------------------------------------- /Huahui.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Huahui/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/.DS_Store -------------------------------------------------------------------------------- /Huahui/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Huahui 4 | // 5 | // Created by Lex on 26/02/2017. 6 | // Copyright © 2017 lexrus.com. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 17 | 18 | window = UIWindow(frame: UIScreen.main.bounds) 19 | window?.backgroundColor = .white 20 | window?.rootViewController = WordsList() 21 | window?.makeKeyAndVisible() 22 | 23 | return true 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/.DS_Store -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | {"images":[{"idiom":"iphone","size":"20x20","scale":"2x","filename":"Icon-App-20x20@2x.png"},{"idiom":"iphone","size":"20x20","scale":"3x","filename":"Icon-App-20x20@3x.png"},{"idiom":"iphone","size":"29x29","scale":"1x","filename":"Icon-App-29x29@1x.png"},{"idiom":"iphone","size":"29x29","scale":"2x","filename":"Icon-App-29x29@2x.png"},{"idiom":"iphone","size":"29x29","scale":"3x","filename":"Icon-App-29x29@3x.png"},{"idiom":"iphone","size":"40x40","scale":"1x","filename":"Icon-App-40x40@1x.png"},{"idiom":"iphone","size":"40x40","scale":"2x","filename":"Icon-App-40x40@2x.png"},{"idiom":"iphone","size":"40x40","scale":"3x","filename":"Icon-App-40x40@3x.png"},{"idiom":"iphone","size":"57x57","scale":"1x","filename":"Icon-App-57x57@1x.png"},{"idiom":"iphone","size":"57x57","scale":"2x","filename":"Icon-App-57x57@2x.png"},{"idiom":"iphone","size":"57x57","scale":"3x","filename":"Icon-App-57x57@3x.png"},{"idiom":"iphone","size":"60x60","scale":"1x","filename":"Icon-App-60x60@1x.png"},{"idiom":"iphone","size":"60x60","scale":"2x","filename":"Icon-App-60x60@2x.png"},{"idiom":"iphone","size":"60x60","scale":"3x","filename":"Icon-App-60x60@3x.png"},{"idiom":"iphone","size":"76x76","scale":"1x","filename":"Icon-App-76x76@1x.png"},{"idiom":"ipad","size":"20x20","scale":"1x","filename":"Icon-App-20x20@1x.png"},{"idiom":"ipad","size":"20x20","scale":"2x","filename":"Icon-App-20x20@2x.png"},{"idiom":"ipad","size":"29x29","scale":"1x","filename":"Icon-App-29x29@1x.png"},{"idiom":"ipad","size":"29x29","scale":"2x","filename":"Icon-App-29x29@2x.png"},{"idiom":"ipad","size":"40x40","scale":"1x","filename":"Icon-App-40x40@1x.png"},{"idiom":"ipad","size":"40x40","scale":"2x","filename":"Icon-App-40x40@2x.png"},{"idiom":"ipad","size":"76x76","scale":"1x","filename":"Icon-App-76x76@1x.png"},{"idiom":"ipad","size":"76x76","scale":"2x","filename":"Icon-App-76x76@2x.png"},{"idiom":"ipad","size":"76x76","scale":"3x","filename":"Icon-App-76x76@3x.png"},{"idiom":"ipad","size":"83.5x83.5","scale":"2x","filename":"Icon-App-83.5x83.5@2x.png"}],"info":{"version":1,"author":"fanstudio"}} -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@3x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@1x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@3x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexrus/Huahui/f667f0a48c6fe2e802e00df44728d2afdeeea840/Huahui/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /Huahui/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Huahui/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 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Huahui/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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UIStatusBarTintParameters 30 | 31 | UINavigationBar 32 | 33 | Style 34 | UIBarStyleDefault 35 | Translucent 36 | 37 | 38 | 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Huahui/Model/Word.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Word.swift 3 | // Huahui 4 | // 5 | // Created by Lex on 26/02/2017. 6 | // Copyright © 2017 lexrus.com. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct Word { 12 | 13 | let UK: String 14 | let US: String 15 | let origin: String 16 | 17 | init(_ origin: String, US: String, UK: String) { 18 | self.origin = origin 19 | self.US = US 20 | self.UK = UK 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Huahui/Model/Words.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Words.swift 3 | // Huahui 4 | // 5 | // Created by Lex on 01/03/2017. 6 | // Copyright © 2017 lexrus.com. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Word { 12 | 13 | static let data: [Word] = [ 14 | Word("access", US: "'ækses", UK: ""), 15 | Word("Angular", US: "'æŋgjʊlə", UK: ""), 16 | Word("AJAX", US: "'eidʒæks", UK: ""), 17 | Word("Apache", US: "ə'pætʃɪ", UK: ""), 18 | Word("archive", US: "'ɑːkaɪv", UK: ""), 19 | Word("array", US: "ə'rei", UK: ""), 20 | Word("avatar", US: "'ævətɑː", UK: ""), 21 | Word("Azure", US: "'æʒə", UK: ""), 22 | Word("cache", US: "kæʃ", UK: ""), 23 | Word("deque", US: "'dek", UK: ""), 24 | Word("digest", US: "'dɑɪdʒɛst", UK: ""), 25 | Word("Django", US: "ˈdʒæŋɡoʊ", UK: ""), 26 | Word("Git", US: "ɡɪt", UK: ""), 27 | Word("height", US: "haɪt", UK: ""), 28 | Word("hidden", US: "'hɪdn", UK: ""), 29 | Word("image", US: "'ɪmɪdʒ", UK: ""), 30 | Word("integer", US: "'ɪntɪdʒə", UK: ""), 31 | Word("issue", US: "'ɪʃuː", UK: ""), 32 | Word("Java", US: "'dʒɑːvə", UK: ""), 33 | Word("Linux", US: "'lɪnəks", UK: ""), 34 | Word("main", US: "meɪn", UK: ""), 35 | Word("margin", US: "'mɑːdʒɪn", UK: ""), 36 | Word("maven", US: "'meɪvn", UK: ""), 37 | Word("module", US: "'mɒdjuːl", UK: ""), 38 | Word("null", US: "nʌl", UK: ""), 39 | Word("parameter", US: "pə'ræmɪtə", UK: ""), 40 | Word("putty", US: "ˈpʌti", UK: ""), 41 | Word("query", US: "'kwɪəri", UK: ""), 42 | Word("resolved", US: "rɪ'zɒlvd", UK: ""), 43 | Word("retina", US: "'retɪnə", UK: ""), 44 | Word("san jose", US: "sænhəu'zei", UK: ""), 45 | Word("safari", US: "sə'fɑːrɪ", UK: ""), 46 | Word("scheme", US: "skiːm", UK: ""), 47 | Word("suite", US: "swiːt", UK: ""), 48 | Word("typical", US: "'tɪpɪkl", UK: ""), 49 | Word("Ubuntu", US: "ʊ'bʊntʊ", UK: ""), 50 | Word("variable", US: "'veəriəbl", UK: ""), 51 | Word("vue", US: "v'ju:", UK: ""), 52 | Word("width", US: "wɪdθ", UK: ""), 53 | Word("YouTube", US: "'juː'tjuːb", UK: "") 54 | ] 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Huahui/View/WordCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WordCell.swift 3 | // Huahui 4 | // 5 | // Created by Lex on 26/02/2017. 6 | // Copyright © 2017 lexrus.com. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | final class WordCell : UITableViewCell { 12 | 13 | static let id = "WordCell" 14 | 15 | override init(style: UITableViewCellStyle, reuseIdentifier: String?) { 16 | super.init(style: .value1, reuseIdentifier: reuseIdentifier) 17 | } 18 | 19 | required init?(coder aDecoder: NSCoder) { 20 | fatalError("init(coder:) has not been implemented") 21 | } 22 | 23 | func configureWithWord(_ word: Word, presentDanielJonesPhoneticSymbol: Bool) { 24 | textLabel?.text = word.origin 25 | 26 | if presentDanielJonesPhoneticSymbol { 27 | detailTextLabel?.text = "[\(word.UK)]" 28 | } else { 29 | detailTextLabel?.text = "[\(word.US)]" 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Huahui/View/WordListHeader.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WordListHeader.swift 3 | // Huahui 4 | // 5 | // Created by Lex on 28/02/2017. 6 | // Copyright © 2017 lexrus.com. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | final class WordListHeader : UIView { 12 | 13 | let countrySegment = UISegmentedControl(items: ["en_US", "en_GB"]) 14 | 15 | init () { 16 | super.init(frame: CGRect.zero) 17 | 18 | addSubview(countrySegment) 19 | 20 | let fontAttr = [ NSFontAttributeName: UIFont.systemFont(ofSize: 18) ] 21 | countrySegment.setTitleTextAttributes(fontAttr, for: .normal) 22 | } 23 | 24 | required init?(coder aDecoder: NSCoder) { 25 | fatalError("init(coder:) has not been implemented") 26 | } 27 | 28 | override func layoutSubviews() { 29 | super.layoutSubviews() 30 | 31 | countrySegment.sizeToFit() 32 | countrySegment.frame.origin.x = (bounds.width - countrySegment.bounds.width) / 2 33 | countrySegment.frame.origin.y = (bounds.height - countrySegment.bounds.height) / 2 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Huahui/WordsList.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WordsList.swift 3 | // Huahui 4 | // 5 | // Created by Lex on 26/02/2017. 6 | // Copyright © 2017 lexrus.com. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import AVFoundation 11 | 12 | final class WordsList : UIViewController { 13 | 14 | fileprivate let tableView = UITableView() 15 | 16 | fileprivate let speechSynthesizer = AVSpeechSynthesizer() 17 | 18 | fileprivate var presentDanielJonesPhoneticSymbol = false 19 | 20 | private let defaults = UserDefaults(suiteName: "Huahui")! 21 | 22 | private let header = WordListHeader() 23 | 24 | fileprivate var words = Word.data 25 | 26 | override func viewDidLoad() { 27 | super.viewDidLoad() 28 | 29 | header.countrySegment.addTarget( 30 | self, 31 | action: #selector(didSelectPhoneticSymbol), 32 | for: .valueChanged 33 | ) 34 | 35 | let dj = defaults.bool(forKey: "dj") 36 | header.countrySegment.selectedSegmentIndex = dj ? 1 : 0 37 | view.addSubview(header) 38 | 39 | view.addSubview(tableView) 40 | 41 | tableView.register(WordCell.self, forCellReuseIdentifier: WordCell.id) 42 | tableView.delegate = self 43 | tableView.dataSource = self 44 | } 45 | 46 | fileprivate func readCell(of indexPath: IndexPath) { 47 | let word = words[indexPath.row] 48 | if speechSynthesizer.isSpeaking { 49 | speechSynthesizer.stopSpeaking(at: AVSpeechBoundary.immediate) 50 | } 51 | 52 | let utterance = AVSpeechUtterance(string: word.origin) 53 | utterance.rate = AVSpeechUtteranceDefaultSpeechRate 54 | 55 | if presentDanielJonesPhoneticSymbol { 56 | utterance.voice = AVSpeechSynthesisVoice(language: "en-GB") 57 | } else { 58 | utterance.voice = AVSpeechSynthesisVoice(language: "en-US") 59 | } 60 | 61 | speechSynthesizer.speak(utterance) 62 | } 63 | 64 | func didSelectPhoneticSymbol() { 65 | presentDanielJonesPhoneticSymbol = header.countrySegment.selectedSegmentIndex == 1 66 | defaults.set(presentDanielJonesPhoneticSymbol, forKey: "dj") 67 | defaults.synchronize() 68 | 69 | tableView.reloadData() 70 | } 71 | 72 | override func viewDidLayoutSubviews() { 73 | header.frame = view.bounds 74 | header.frame.size.height = 50 75 | header.frame.origin.y = 20 76 | 77 | tableView.frame = view.bounds 78 | tableView.frame.size.height = view.bounds.height - header.frame.maxY 79 | tableView.frame.origin.y = header.frame.maxY 80 | } 81 | 82 | } 83 | 84 | extension WordsList : UITableViewDelegate, UITableViewDataSource { 85 | 86 | func numberOfSections(in tableView: UITableView) -> Int { 87 | return 1 88 | } 89 | 90 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 91 | return words.count 92 | } 93 | 94 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 95 | guard let cell = tableView.dequeueReusableCell(withIdentifier: WordCell.id) as? WordCell else { 96 | return UITableViewCell() 97 | } 98 | 99 | let word = words[indexPath.row] 100 | cell.configureWithWord(word, presentDanielJonesPhoneticSymbol: presentDanielJonesPhoneticSymbol) 101 | 102 | return cell 103 | } 104 | 105 | func tableView(_ tableView: UITableView, didHighlightRowAt indexPath: IndexPath) { 106 | readCell(of: indexPath) 107 | } 108 | 109 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 110 | tableView.deselectRow(at: indexPath, animated: true) 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SOURCE_URL = "https://raw.githubusercontent.com/shimohq/chinese-programmer-wrong-pronunciation/master/README.md" 2 | TMP_FILE = /tmp/README.md 3 | FIELD_SEPARATOR = "|" 4 | 5 | define AWK_FUNCTIONS 6 | function trim(s) { gsub(/(^[ \t\r\n]+|[ \t\r\n]+$$)/, "", s); return s } \ 7 | function extractWord(s) { sub(/\[.+$$/, "", s); return trim(s) } \ 8 | function removeEmptyPhonetics(s) { sub(/\[\]/, "", s); return s } \ 9 | function extractPhonetic(s) { \ 10 | if ( s ~ /\[/ ) { \ 11 | gsub(/(^.*\[|\].*$$)/, "", s) \ 12 | } else { \ 13 | gsub(/[^a-zA-Z ]+/, "", s) \ 14 | }; \ 15 | return removeEmptyPhonetics(trim(s)) \ 16 | } 17 | endef 18 | 19 | define PRINT_SWIFT_ARRAY 20 | printf("Word(\"%s\", US=\"%s\", UK=\"\"),\n", \ 21 | extractWord($$2), extractPhonetic($$3) \ 22 | ) 23 | endef 24 | 25 | define PRINT_JAVA_ARRAY 26 | printf("words.add(new Word(\"%s\", \"[%s]\", \"[%s]\", true));\n", \ 27 | extractWord($$2), extractPhonetic($$3), extractPhonetic($$4) \ 28 | ) 29 | endef 30 | 31 | fetch: 32 | curl -Lo ${TMP_FILE} ${SOURCE_URL} 33 | 34 | export_swift: 35 | @awk -F${FIELD_SEPARATOR} \ 36 | '${AWK_FUNCTIONS} $$2~/[a-zA-Z]+/ { ${PRINT_SWIFT_ARRAY} }' ${TMP_FILE} | pbcopy 37 | @echo "Copied to your pasteboard." 38 | 39 | export_java: 40 | @awk -F${FIELD_SEPARATOR} \ 41 | '${AWK_FUNCTIONS} $$2~/[a-zA-Z]+/ { ${PRINT_JAVA_ARRAY} }' ${TMP_FILE} | pbcopy 42 | @echo "Copied to your pasteboard." 43 | 44 | .PHONY: fetch export_swift 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 花灰 ![Language](https://img.shields.io/badge/language-Swift%203-orange.svg) 2 | 3 | icon 4 | 5 | 这个小 App 用 UITableView 陈列了一些中国程序员经常读错的单词,用 AVFoundation 实现美音和英音的朗读,用 curl 和 awk 同步词库。功能异常简陋,实现非常粗暴,仅供 iOS 程序员自行编译,纠正发音使用,懒得提交 App Store。 6 | 7 | 使用效果见: https://twitter.com/lexrus/status/836928202912063491 8 | 9 | ### 鸣谢 10 | 11 | 单词列表引自 [中国程序员容易发音错误的单词](https://github.com/shimohq/chinese-programmer-wrong-pronunciation),非常感谢这个仓库的创建者。 12 | 13 | 感谢 @liyu 实现了 Android 版: https://github.com/li-yu/Huahui-Android 14 | 15 | ### 如何更新词库 16 | 17 | `make fetch` 下载 README.md 到 /tmp 目录; 18 | 19 | `make export_swift` 从更新后的 README 生成 Swift 并放入粘贴板; 20 | 21 | `make export_java` 生成对应的 Java 语句。 22 | 23 | 注:由于源库没有使用标准的数据格式,此 awk 程序可能在 README 更新后失败。 24 | --------------------------------------------------------------------------------