├── .gitignore ├── .ruby-gemset ├── .ruby-version ├── .swift-version ├── .swiftlint.yml ├── .travis.yml ├── Brewfile ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── MLSwiftUtils.podspec ├── MLSwiftUtils.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── WorkspaceSettings.xcsettings └── xcshareddata │ └── xcschemes │ ├── MLSwiftUtils.xcscheme │ └── PodTest.xcscheme ├── MLSwiftUtils.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ ├── IDEWorkspaceChecks.plist │ └── WorkspaceSettings.xcsettings ├── PodTest ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist └── ViewController.swift ├── Podfile ├── Podfile.lock ├── README.md ├── Sources ├── Classes │ ├── AlertController.swift │ ├── Label.swift │ ├── RefreshControl.swift │ └── TableView.swift ├── Extensions │ ├── Array.swift │ ├── Bool.swift │ ├── CGGeometry.swift │ ├── Dictionary.swift │ ├── Double.swift │ ├── Float.swift │ ├── Int.swift │ ├── NSBundle.swift │ ├── NSData.swift │ ├── NSDate.swift │ ├── NSFileManager.swift │ ├── NSLock.swift │ ├── NSURL.swift │ ├── Range.swift │ ├── Regex.swift │ ├── String.swift │ ├── UICollectionView.swift │ ├── UIColor.swift │ ├── UIGeometry.swift │ ├── UIImage.swift │ ├── UILayoutPriority.swift │ ├── UITableView.swift │ ├── UIView.swift │ └── UIViewController.swift └── Info.plist ├── Tests ├── Array.swift ├── Bool.swift ├── Data │ ├── TestView.swift │ └── TestView.xib ├── Info.plist ├── String.swift └── UIView.swift ├── fastlane ├── Fastfile └── Scanfile └── scripts ├── branch ├── codecov ├── install ├── lint ├── pod_test ├── pr_number ├── setup ├── setup_rbenv ├── src_branch ├── test └── validate_branch /.gitignore: -------------------------------------------------------------------------------- 1 | ### Swift ### 2 | # Xcode 3 | # 4 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 5 | 6 | ## Build generated 7 | build/ 8 | DerivedData/ 9 | 10 | ## Various settings 11 | *.pbxuser 12 | !default.pbxuser 13 | *.mode1v3 14 | !default.mode1v3 15 | *.mode2v3 16 | !default.mode2v3 17 | *.perspectivev3 18 | !default.perspectivev3 19 | xcuserdata/ 20 | 21 | ## Other 22 | *.moved-aside 23 | *.xccheckout 24 | *.xcscmblueprint 25 | *.DS_Store 26 | 27 | ## Obj-C/Swift specific 28 | *.hmap 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | .build/ 43 | 44 | # CocoaPods 45 | # 46 | # We recommend against adding the Pods directory to your .gitignore. However 47 | # you should judge for yourself, the pros and cons are mentioned at: 48 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 49 | Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | Carthage/Checkouts 55 | Carthage/Build 56 | 57 | # fastlane 58 | # 59 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 60 | # screenshots whenever they are needed. 61 | # For more information about the recommended setup visit: 62 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 63 | 64 | fastlane/report.xml 65 | fastlane/Preview.html 66 | fastlane/screenshots 67 | fastlane/README.md 68 | fastlane/test_output 69 | 70 | # Bundler 71 | vendor 72 | .bundle.bundle 73 | .bundle 74 | vendor/bundle 75 | *.coverage.txt 76 | swiftlint-report.json 77 | -------------------------------------------------------------------------------- /.ruby-gemset: -------------------------------------------------------------------------------- 1 | ci 2 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 3.1.3 2 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 5.0 2 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | # reporter: xcode 2 | disabled_rules: 3 | - identifier_name 4 | excluded: 5 | - Pods 6 | line_length: 300 7 | file_length: 1000 8 | function_body_length: 9 | - 50 10 | - 100 11 | type_body_length: 12 | - 300 13 | - 500 14 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode10 3 | cache: 4 | - bundler 5 | - cocoapods 6 | install: 7 | - set -o pipefail 8 | - sudo systemsetup -settimezone Asia/Ho_Chi_Minh 9 | - bundle install --path=vendor/bundle --jobs 4 --retry 3 10 | script: 11 | - ./scripts/branch 12 | - bundle exec pod install --repo-update 13 | - ./scripts/lint 14 | - bundle exec fastlane test -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | brew 'swiftlint' 2 | brew 'jq' -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem 'xcpretty'#, '0.2.8' 4 | gem 'cocoapods', '1.15.2' 5 | gem 'linterbot'#, '0.2.7' 6 | gem 'fastlane' 7 | gem 'json'#, '~> 2.0.3' 8 | 9 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (3.0.7) 5 | base64 6 | nkf 7 | rexml 8 | activesupport (7.2.2.1) 9 | base64 10 | benchmark (>= 0.3) 11 | bigdecimal 12 | concurrent-ruby (~> 1.0, >= 1.3.1) 13 | connection_pool (>= 2.2.5) 14 | drb 15 | i18n (>= 1.6, < 2) 16 | logger (>= 1.4.2) 17 | minitest (>= 5.1) 18 | securerandom (>= 0.3) 19 | tzinfo (~> 2.0, >= 2.0.5) 20 | addressable (2.8.7) 21 | public_suffix (>= 2.0.2, < 7.0) 22 | algoliasearch (1.27.5) 23 | httpclient (~> 2.8, >= 2.8.3) 24 | json (>= 1.5.1) 25 | artifactory (3.0.17) 26 | atomos (0.1.3) 27 | aws-eventstream (1.4.0) 28 | aws-partitions (1.1110.0) 29 | aws-sdk-core (3.225.0) 30 | aws-eventstream (~> 1, >= 1.3.0) 31 | aws-partitions (~> 1, >= 1.992.0) 32 | aws-sigv4 (~> 1.9) 33 | base64 34 | jmespath (~> 1, >= 1.6.1) 35 | logger 36 | aws-sdk-kms (1.102.0) 37 | aws-sdk-core (~> 3, >= 3.225.0) 38 | aws-sigv4 (~> 1.5) 39 | aws-sdk-s3 (1.189.0) 40 | aws-sdk-core (~> 3, >= 3.225.0) 41 | aws-sdk-kms (~> 1) 42 | aws-sigv4 (~> 1.5) 43 | aws-sigv4 (1.12.0) 44 | aws-eventstream (~> 1, >= 1.0.2) 45 | babosa (1.0.4) 46 | base64 (0.3.0) 47 | benchmark (0.4.1) 48 | bigdecimal (3.2.1) 49 | claide (1.1.0) 50 | cocoapods (1.15.2) 51 | addressable (~> 2.8) 52 | claide (>= 1.0.2, < 2.0) 53 | cocoapods-core (= 1.15.2) 54 | cocoapods-deintegrate (>= 1.0.3, < 2.0) 55 | cocoapods-downloader (>= 2.1, < 3.0) 56 | cocoapods-plugins (>= 1.0.0, < 2.0) 57 | cocoapods-search (>= 1.0.0, < 2.0) 58 | cocoapods-trunk (>= 1.6.0, < 2.0) 59 | cocoapods-try (>= 1.1.0, < 2.0) 60 | colored2 (~> 3.1) 61 | escape (~> 0.0.4) 62 | fourflusher (>= 2.3.0, < 3.0) 63 | gh_inspector (~> 1.0) 64 | molinillo (~> 0.8.0) 65 | nap (~> 1.0) 66 | ruby-macho (>= 2.3.0, < 3.0) 67 | xcodeproj (>= 1.23.0, < 2.0) 68 | cocoapods-core (1.15.2) 69 | activesupport (>= 5.0, < 8) 70 | addressable (~> 2.8) 71 | algoliasearch (~> 1.0) 72 | concurrent-ruby (~> 1.1) 73 | fuzzy_match (~> 2.0.4) 74 | nap (~> 1.0) 75 | netrc (~> 0.11) 76 | public_suffix (~> 4.0) 77 | typhoeus (~> 1.0) 78 | cocoapods-deintegrate (1.0.5) 79 | cocoapods-downloader (2.1) 80 | cocoapods-plugins (1.0.0) 81 | nap 82 | cocoapods-search (1.0.1) 83 | cocoapods-trunk (1.6.0) 84 | nap (>= 0.8, < 2.0) 85 | netrc (~> 0.11) 86 | cocoapods-try (1.2.0) 87 | colored (1.2) 88 | colored2 (3.1.2) 89 | commander (4.6.0) 90 | highline (~> 2.0.0) 91 | concurrent-ruby (1.3.5) 92 | connection_pool (2.5.3) 93 | declarative (0.0.20) 94 | digest-crc (0.7.0) 95 | rake (>= 12.0.0, < 14.0.0) 96 | domain_name (0.6.20240107) 97 | dotenv (2.8.1) 98 | drb (2.2.3) 99 | emoji_regex (3.2.3) 100 | escape (0.0.4) 101 | ethon (0.16.0) 102 | ffi (>= 1.15.0) 103 | excon (0.112.0) 104 | faraday (1.10.4) 105 | faraday-em_http (~> 1.0) 106 | faraday-em_synchrony (~> 1.0) 107 | faraday-excon (~> 1.1) 108 | faraday-httpclient (~> 1.0) 109 | faraday-multipart (~> 1.0) 110 | faraday-net_http (~> 1.0) 111 | faraday-net_http_persistent (~> 1.0) 112 | faraday-patron (~> 1.0) 113 | faraday-rack (~> 1.0) 114 | faraday-retry (~> 1.0) 115 | ruby2_keywords (>= 0.0.4) 116 | faraday-cookie_jar (0.0.7) 117 | faraday (>= 0.8.0) 118 | http-cookie (~> 1.0.0) 119 | faraday-em_http (1.0.0) 120 | faraday-em_synchrony (1.0.0) 121 | faraday-excon (1.1.0) 122 | faraday-httpclient (1.0.1) 123 | faraday-multipart (1.1.0) 124 | multipart-post (~> 2.0) 125 | faraday-net_http (1.0.2) 126 | faraday-net_http_persistent (1.2.0) 127 | faraday-patron (1.0.0) 128 | faraday-rack (1.0.0) 129 | faraday-retry (1.0.3) 130 | faraday_middleware (1.2.1) 131 | faraday (~> 1.0) 132 | fastimage (2.4.0) 133 | fastlane (2.227.2) 134 | CFPropertyList (>= 2.3, < 4.0.0) 135 | addressable (>= 2.8, < 3.0.0) 136 | artifactory (~> 3.0) 137 | aws-sdk-s3 (~> 1.0) 138 | babosa (>= 1.0.3, < 2.0.0) 139 | bundler (>= 1.12.0, < 3.0.0) 140 | colored (~> 1.2) 141 | commander (~> 4.6) 142 | dotenv (>= 2.1.1, < 3.0.0) 143 | emoji_regex (>= 0.1, < 4.0) 144 | excon (>= 0.71.0, < 1.0.0) 145 | faraday (~> 1.0) 146 | faraday-cookie_jar (~> 0.0.6) 147 | faraday_middleware (~> 1.0) 148 | fastimage (>= 2.1.0, < 3.0.0) 149 | fastlane-sirp (>= 1.0.0) 150 | gh_inspector (>= 1.1.2, < 2.0.0) 151 | google-apis-androidpublisher_v3 (~> 0.3) 152 | google-apis-playcustomapp_v1 (~> 0.1) 153 | google-cloud-env (>= 1.6.0, < 2.0.0) 154 | google-cloud-storage (~> 1.31) 155 | highline (~> 2.0) 156 | http-cookie (~> 1.0.5) 157 | json (< 3.0.0) 158 | jwt (>= 2.1.0, < 3) 159 | mini_magick (>= 4.9.4, < 5.0.0) 160 | multipart-post (>= 2.0.0, < 3.0.0) 161 | naturally (~> 2.2) 162 | optparse (>= 0.1.1, < 1.0.0) 163 | plist (>= 3.1.0, < 4.0.0) 164 | rubyzip (>= 2.0.0, < 3.0.0) 165 | security (= 0.1.5) 166 | simctl (~> 1.6.3) 167 | terminal-notifier (>= 2.0.0, < 3.0.0) 168 | terminal-table (~> 3) 169 | tty-screen (>= 0.6.3, < 1.0.0) 170 | tty-spinner (>= 0.8.0, < 1.0.0) 171 | word_wrap (~> 1.0.0) 172 | xcodeproj (>= 1.13.0, < 2.0.0) 173 | xcpretty (~> 0.4.1) 174 | xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) 175 | fastlane-sirp (1.0.0) 176 | sysrandom (~> 1.0) 177 | ffi (1.17.2) 178 | ffi (1.17.2-aarch64-linux-gnu) 179 | ffi (1.17.2-aarch64-linux-musl) 180 | ffi (1.17.2-arm-linux-gnu) 181 | ffi (1.17.2-arm-linux-musl) 182 | ffi (1.17.2-arm64-darwin) 183 | ffi (1.17.2-x86-linux-gnu) 184 | ffi (1.17.2-x86-linux-musl) 185 | ffi (1.17.2-x86_64-darwin) 186 | ffi (1.17.2-x86_64-linux-gnu) 187 | ffi (1.17.2-x86_64-linux-musl) 188 | fourflusher (2.3.1) 189 | fuzzy_match (2.0.4) 190 | gh_inspector (1.1.3) 191 | google-apis-androidpublisher_v3 (0.54.0) 192 | google-apis-core (>= 0.11.0, < 2.a) 193 | google-apis-core (0.11.3) 194 | addressable (~> 2.5, >= 2.5.1) 195 | googleauth (>= 0.16.2, < 2.a) 196 | httpclient (>= 2.8.1, < 3.a) 197 | mini_mime (~> 1.0) 198 | representable (~> 3.0) 199 | retriable (>= 2.0, < 4.a) 200 | rexml 201 | google-apis-iamcredentials_v1 (0.17.0) 202 | google-apis-core (>= 0.11.0, < 2.a) 203 | google-apis-playcustomapp_v1 (0.13.0) 204 | google-apis-core (>= 0.11.0, < 2.a) 205 | google-apis-storage_v1 (0.31.0) 206 | google-apis-core (>= 0.11.0, < 2.a) 207 | google-cloud-core (1.8.0) 208 | google-cloud-env (>= 1.0, < 3.a) 209 | google-cloud-errors (~> 1.0) 210 | google-cloud-env (1.6.0) 211 | faraday (>= 0.17.3, < 3.0) 212 | google-cloud-errors (1.5.0) 213 | google-cloud-storage (1.47.0) 214 | addressable (~> 2.8) 215 | digest-crc (~> 0.4) 216 | google-apis-iamcredentials_v1 (~> 0.1) 217 | google-apis-storage_v1 (~> 0.31.0) 218 | google-cloud-core (~> 1.6) 219 | googleauth (>= 0.16.2, < 2.a) 220 | mini_mime (~> 1.0) 221 | googleauth (1.8.1) 222 | faraday (>= 0.17.3, < 3.a) 223 | jwt (>= 1.4, < 3.0) 224 | multi_json (~> 1.11) 225 | os (>= 0.9, < 2.0) 226 | signet (>= 0.16, < 2.a) 227 | highline (2.0.3) 228 | http-cookie (1.0.8) 229 | domain_name (~> 0.5) 230 | httpclient (2.9.0) 231 | mutex_m 232 | i18n (1.14.7) 233 | concurrent-ruby (~> 1.0) 234 | jmespath (1.6.2) 235 | json (2.12.2) 236 | jwt (2.10.1) 237 | base64 238 | linterbot (0.2.7) 239 | commander (~> 4.3) 240 | octokit (~> 4.2) 241 | logger (1.7.0) 242 | mini_magick (4.13.2) 243 | mini_mime (1.1.5) 244 | minitest (5.25.5) 245 | molinillo (0.8.0) 246 | multi_json (1.15.0) 247 | multipart-post (2.4.1) 248 | mutex_m (0.3.0) 249 | nanaimo (0.4.0) 250 | nap (1.1.0) 251 | naturally (2.2.1) 252 | netrc (0.11.0) 253 | nkf (0.2.0) 254 | octokit (4.25.1) 255 | faraday (>= 1, < 3) 256 | sawyer (~> 0.9) 257 | optparse (0.6.0) 258 | os (1.1.4) 259 | plist (3.7.2) 260 | public_suffix (4.0.7) 261 | rake (13.3.0) 262 | representable (3.2.0) 263 | declarative (< 0.1.0) 264 | trailblazer-option (>= 0.1.1, < 0.2.0) 265 | uber (< 0.2.0) 266 | retriable (3.1.2) 267 | rexml (3.4.1) 268 | rouge (3.28.0) 269 | ruby-macho (2.5.1) 270 | ruby2_keywords (0.0.5) 271 | rubyzip (2.4.1) 272 | sawyer (0.9.2) 273 | addressable (>= 2.3.5) 274 | faraday (>= 0.17.3, < 3) 275 | securerandom (0.4.1) 276 | security (0.1.5) 277 | signet (0.20.0) 278 | addressable (~> 2.8) 279 | faraday (>= 0.17.5, < 3.a) 280 | jwt (>= 1.5, < 3.0) 281 | multi_json (~> 1.10) 282 | simctl (1.6.10) 283 | CFPropertyList 284 | naturally 285 | sysrandom (1.0.5) 286 | terminal-notifier (2.0.0) 287 | terminal-table (3.0.2) 288 | unicode-display_width (>= 1.1.1, < 3) 289 | trailblazer-option (0.1.2) 290 | tty-cursor (0.7.1) 291 | tty-screen (0.8.2) 292 | tty-spinner (0.9.3) 293 | tty-cursor (~> 0.7) 294 | typhoeus (1.4.1) 295 | ethon (>= 0.9.0) 296 | tzinfo (2.0.6) 297 | concurrent-ruby (~> 1.0) 298 | uber (0.1.0) 299 | unicode-display_width (2.6.0) 300 | word_wrap (1.0.0) 301 | xcodeproj (1.27.0) 302 | CFPropertyList (>= 2.3.3, < 4.0) 303 | atomos (~> 0.1.3) 304 | claide (>= 1.0.2, < 2.0) 305 | colored2 (~> 3.1) 306 | nanaimo (~> 0.4.0) 307 | rexml (>= 3.3.6, < 4.0) 308 | xcpretty (0.4.1) 309 | rouge (~> 3.28.0) 310 | xcpretty-travis-formatter (1.0.1) 311 | xcpretty (~> 0.2, >= 0.0.7) 312 | 313 | PLATFORMS 314 | aarch64-linux-gnu 315 | aarch64-linux-musl 316 | arm-linux-gnu 317 | arm-linux-musl 318 | arm64-darwin 319 | ruby 320 | x86-linux-gnu 321 | x86-linux-musl 322 | x86_64-darwin 323 | x86_64-linux-gnu 324 | x86_64-linux-musl 325 | 326 | DEPENDENCIES 327 | cocoapods (= 1.15.2) 328 | fastlane 329 | json 330 | linterbot 331 | xcpretty 332 | 333 | BUNDLED WITH 334 | 2.5.22 335 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /MLSwiftUtils.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'MLSwiftUtils' 3 | s.version = '5.0.0' 4 | s.license = 'MIT' 5 | s.summary = 'MLSwiftUtils' 6 | s.homepage = 'https://github.com/blkbrds/swiftutils-ios' 7 | s.authors = { 'Dai Ho' => 'daiho' } 8 | s.source = { :git => 'https://github.com/blkbrds/swiftutils-ios.git', :tag => s.version} 9 | s.requires_arc = true 10 | s.ios.deployment_target = '14.0' 11 | s.swift_version = '5.0' 12 | s.ios.frameworks = 'Foundation', 'UIKit' 13 | s.source_files = 'Sources/Classes/*.swift', 'Sources/Extensions/*.swift' 14 | end 15 | -------------------------------------------------------------------------------- /MLSwiftUtils.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 12C986317B77D7ABFB3C3C6F /* Pods_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD2BECCF992B0D91E960C280 /* Pods_Tests.framework */; }; 11 | 9B0B04A766D90744A21FACC4 /* Pods_MLSwiftUtils.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BD268572D0CD479E99DA436 /* Pods_MLSwiftUtils.framework */; }; 12 | B204CC319B099051C03BDD4C /* Pods_PodTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC90DFF29AB37B6D0DEBE45A /* Pods_PodTest.framework */; }; 13 | EC21919C1D49D65000CA1314 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC21919B1D49D65000CA1314 /* String.swift */; }; 14 | EC41F5E91D7BFD820081758D /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC41F5E81D7BFD820081758D /* UIView.swift */; }; 15 | EC41F5EC1D7BFE4A0081758D /* TestView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC41F5EB1D7BFE4A0081758D /* TestView.swift */; }; 16 | EC41F5EE1D7BFE550081758D /* TestView.xib in Resources */ = {isa = PBXBuildFile; fileRef = EC41F5ED1D7BFE550081758D /* TestView.xib */; }; 17 | EC45F2871D92A26F00A26AF0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC45F2861D92A26F00A26AF0 /* AppDelegate.swift */; }; 18 | EC45F2891D92A26F00A26AF0 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC45F2881D92A26F00A26AF0 /* ViewController.swift */; }; 19 | EC45F28C1D92A26F00A26AF0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EC45F28A1D92A26F00A26AF0 /* Main.storyboard */; }; 20 | EC45F28E1D92A26F00A26AF0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EC45F28D1D92A26F00A26AF0 /* Assets.xcassets */; }; 21 | EC45F2911D92A26F00A26AF0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EC45F28F1D92A26F00A26AF0 /* LaunchScreen.storyboard */; }; 22 | EC7343EF1D05698C00FE3F92 /* Bool.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC7343EE1D05698C00FE3F92 /* Bool.swift */; }; 23 | ECA6D5DA1C83E68E00A3D848 /* MLSwiftUtils.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ECD9E6D81BC24428001F8738 /* MLSwiftUtils.framework */; }; 24 | ECA6D5E11C83E89B00A3D848 /* Array.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECA6D5E01C83E89B00A3D848 /* Array.swift */; }; 25 | ECBAE7971DB773A600E520CE /* AlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7761DB773A600E520CE /* AlertController.swift */; }; 26 | ECBAE7981DB773A600E520CE /* Label.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7771DB773A600E520CE /* Label.swift */; }; 27 | ECBAE7991DB773A600E520CE /* RefreshControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7781DB773A600E520CE /* RefreshControl.swift */; }; 28 | ECBAE79B1DB773A600E520CE /* TableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE77A1DB773A600E520CE /* TableView.swift */; }; 29 | ECBAE79D1DB773A600E520CE /* Array.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE77D1DB773A600E520CE /* Array.swift */; }; 30 | ECBAE79E1DB773A600E520CE /* Bool.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE77E1DB773A600E520CE /* Bool.swift */; }; 31 | ECBAE79F1DB773A600E520CE /* CGGeometry.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE77F1DB773A600E520CE /* CGGeometry.swift */; }; 32 | ECBAE7A01DB773A600E520CE /* Dictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7801DB773A600E520CE /* Dictionary.swift */; }; 33 | ECBAE7A11DB773A600E520CE /* Double.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7811DB773A600E520CE /* Double.swift */; }; 34 | ECBAE7A21DB773A600E520CE /* Float.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7821DB773A600E520CE /* Float.swift */; }; 35 | ECBAE7A31DB773A600E520CE /* Int.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7831DB773A600E520CE /* Int.swift */; }; 36 | ECBAE7A41DB773A600E520CE /* NSBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7841DB773A600E520CE /* NSBundle.swift */; }; 37 | ECBAE7A61DB773A600E520CE /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7861DB773A600E520CE /* NSData.swift */; }; 38 | ECBAE7A71DB773A600E520CE /* NSDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7871DB773A600E520CE /* NSDate.swift */; }; 39 | ECBAE7A81DB773A600E520CE /* NSFileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7881DB773A600E520CE /* NSFileManager.swift */; }; 40 | ECBAE7A91DB773A600E520CE /* NSLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7891DB773A600E520CE /* NSLock.swift */; }; 41 | ECBAE7AA1DB773A600E520CE /* NSURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE78A1DB773A600E520CE /* NSURL.swift */; }; 42 | ECBAE7AB1DB773A600E520CE /* Range.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE78B1DB773A600E520CE /* Range.swift */; }; 43 | ECBAE7AC1DB773A600E520CE /* Regex.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE78C1DB773A600E520CE /* Regex.swift */; }; 44 | ECBAE7AD1DB773A600E520CE /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE78D1DB773A600E520CE /* String.swift */; }; 45 | ECBAE7AE1DB773A600E520CE /* UICollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE78E1DB773A600E520CE /* UICollectionView.swift */; }; 46 | ECBAE7AF1DB773A600E520CE /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE78F1DB773A600E520CE /* UIColor.swift */; }; 47 | ECBAE7B01DB773A600E520CE /* UIGeometry.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7901DB773A600E520CE /* UIGeometry.swift */; }; 48 | ECBAE7B11DB773A600E520CE /* UIImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7911DB773A600E520CE /* UIImage.swift */; }; 49 | ECBAE7B21DB773A600E520CE /* UILayoutPriority.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7921DB773A600E520CE /* UILayoutPriority.swift */; }; 50 | ECBAE7B31DB773A600E520CE /* UITableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7931DB773A600E520CE /* UITableView.swift */; }; 51 | ECBAE7B41DB773A600E520CE /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7941DB773A600E520CE /* UIView.swift */; }; 52 | ECBAE7B51DB773A600E520CE /* UIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECBAE7951DB773A600E520CE /* UIViewController.swift */; }; 53 | /* End PBXBuildFile section */ 54 | 55 | /* Begin PBXContainerItemProxy section */ 56 | ECA6D5DB1C83E68E00A3D848 /* PBXContainerItemProxy */ = { 57 | isa = PBXContainerItemProxy; 58 | containerPortal = ECD9E6CF1BC24428001F8738 /* Project object */; 59 | proxyType = 1; 60 | remoteGlobalIDString = ECD9E6D71BC24428001F8738; 61 | remoteInfo = SwiftUtils; 62 | }; 63 | ECE5D8A61DB8762B00193DD5 /* PBXContainerItemProxy */ = { 64 | isa = PBXContainerItemProxy; 65 | containerPortal = ECD9E6CF1BC24428001F8738 /* Project object */; 66 | proxyType = 1; 67 | remoteGlobalIDString = ECD9E6D71BC24428001F8738; 68 | remoteInfo = SwiftUtils; 69 | }; 70 | /* End PBXContainerItemProxy section */ 71 | 72 | /* Begin PBXFileReference section */ 73 | 024427016ED960227D9A8CC7 /* Pods-Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig"; sourceTree = ""; }; 74 | 12CA0CA242CAE5AFAAF2F3DB /* Pods-MLSwiftUtils.releasetest.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MLSwiftUtils.releasetest.xcconfig"; path = "Pods/Target Support Files/Pods-MLSwiftUtils/Pods-MLSwiftUtils.releasetest.xcconfig"; sourceTree = ""; }; 75 | 5A78C09A78B70F30AE14F808 /* Pods-PodTest.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PodTest.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PodTest/Pods-PodTest.debug.xcconfig"; sourceTree = ""; }; 76 | 657BC397D02EF97097BADC6C /* Pods-MLSwiftUtils.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MLSwiftUtils.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MLSwiftUtils/Pods-MLSwiftUtils.debug.xcconfig"; sourceTree = ""; }; 77 | 71476F41AA0C7E0C7C36A603 /* Pods-SwiftUtils.releasetest.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftUtils.releasetest.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftUtils/Pods-SwiftUtils.releasetest.xcconfig"; sourceTree = ""; }; 78 | 759E4A4DB4B0314C10C71ACD /* Pods-SwiftUtils.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftUtils.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftUtils/Pods-SwiftUtils.release.xcconfig"; sourceTree = ""; }; 79 | 7BD268572D0CD479E99DA436 /* Pods_MLSwiftUtils.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MLSwiftUtils.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 80 | 90CAB0307928F923616893B0 /* Pods-PodTest.releasetest.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PodTest.releasetest.xcconfig"; path = "Pods/Target Support Files/Pods-PodTest/Pods-PodTest.releasetest.xcconfig"; sourceTree = ""; }; 81 | AD2BECCF992B0D91E960C280 /* Pods_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 82 | BA65799C3A6863E6773DB55A /* Pods-MLSwiftUtils.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MLSwiftUtils.release.xcconfig"; path = "Pods/Target Support Files/Pods-MLSwiftUtils/Pods-MLSwiftUtils.release.xcconfig"; sourceTree = ""; }; 83 | BA6749A325B44D0D074C6081 /* Pods-Tests.releasetest.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.releasetest.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.releasetest.xcconfig"; sourceTree = ""; }; 84 | CC90DFF29AB37B6D0DEBE45A /* Pods_PodTest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PodTest.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 85 | D36ADDDB6B5360976D618F19 /* Pods-PodTest.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PodTest.release.xcconfig"; path = "Pods/Target Support Files/Pods-PodTest/Pods-PodTest.release.xcconfig"; sourceTree = ""; }; 86 | E127B7F845E47BA2468CDBF1 /* Pods-SwiftUtils.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftUtils.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftUtils/Pods-SwiftUtils.debug.xcconfig"; sourceTree = ""; }; 87 | EC21919B1D49D65000CA1314 /* String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = ""; }; 88 | EC41F5E81D7BFD820081758D /* UIView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIView.swift; sourceTree = ""; }; 89 | EC41F5EB1D7BFE4A0081758D /* TestView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestView.swift; sourceTree = ""; }; 90 | EC41F5ED1D7BFE550081758D /* TestView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TestView.xib; sourceTree = ""; }; 91 | EC45F2841D92A26F00A26AF0 /* PodTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PodTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 92 | EC45F2861D92A26F00A26AF0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 93 | EC45F2881D92A26F00A26AF0 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 94 | EC45F28B1D92A26F00A26AF0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 95 | EC45F28D1D92A26F00A26AF0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 96 | EC45F2901D92A26F00A26AF0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97 | EC45F2921D92A26F00A26AF0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 98 | EC7343EE1D05698C00FE3F92 /* Bool.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bool.swift; sourceTree = ""; }; 99 | ECA6D5D51C83E68E00A3D848 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 100 | ECA6D5D91C83E68E00A3D848 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 101 | ECA6D5E01C83E89B00A3D848 /* Array.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Array.swift; sourceTree = ""; }; 102 | ECBAE7761DB773A600E520CE /* AlertController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertController.swift; sourceTree = ""; }; 103 | ECBAE7771DB773A600E520CE /* Label.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = ""; }; 104 | ECBAE7781DB773A600E520CE /* RefreshControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RefreshControl.swift; sourceTree = ""; }; 105 | ECBAE77A1DB773A600E520CE /* TableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableView.swift; sourceTree = ""; }; 106 | ECBAE77D1DB773A600E520CE /* Array.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Array.swift; sourceTree = ""; }; 107 | ECBAE77E1DB773A600E520CE /* Bool.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bool.swift; sourceTree = ""; }; 108 | ECBAE77F1DB773A600E520CE /* CGGeometry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGGeometry.swift; sourceTree = ""; }; 109 | ECBAE7801DB773A600E520CE /* Dictionary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Dictionary.swift; sourceTree = ""; }; 110 | ECBAE7811DB773A600E520CE /* Double.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Double.swift; sourceTree = ""; }; 111 | ECBAE7821DB773A600E520CE /* Float.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Float.swift; sourceTree = ""; }; 112 | ECBAE7831DB773A600E520CE /* Int.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Int.swift; sourceTree = ""; }; 113 | ECBAE7841DB773A600E520CE /* NSBundle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSBundle.swift; sourceTree = ""; }; 114 | ECBAE7861DB773A600E520CE /* NSData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSData.swift; sourceTree = ""; }; 115 | ECBAE7871DB773A600E520CE /* NSDate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDate.swift; sourceTree = ""; }; 116 | ECBAE7881DB773A600E520CE /* NSFileManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSFileManager.swift; sourceTree = ""; }; 117 | ECBAE7891DB773A600E520CE /* NSLock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSLock.swift; sourceTree = ""; }; 118 | ECBAE78A1DB773A600E520CE /* NSURL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSURL.swift; sourceTree = ""; }; 119 | ECBAE78B1DB773A600E520CE /* Range.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Range.swift; sourceTree = ""; }; 120 | ECBAE78C1DB773A600E520CE /* Regex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Regex.swift; sourceTree = ""; }; 121 | ECBAE78D1DB773A600E520CE /* String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = ""; }; 122 | ECBAE78E1DB773A600E520CE /* UICollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICollectionView.swift; sourceTree = ""; }; 123 | ECBAE78F1DB773A600E520CE /* UIColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = ""; }; 124 | ECBAE7901DB773A600E520CE /* UIGeometry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIGeometry.swift; sourceTree = ""; }; 125 | ECBAE7911DB773A600E520CE /* UIImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImage.swift; sourceTree = ""; }; 126 | ECBAE7921DB773A600E520CE /* UILayoutPriority.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UILayoutPriority.swift; sourceTree = ""; }; 127 | ECBAE7931DB773A600E520CE /* UITableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UITableView.swift; sourceTree = ""; }; 128 | ECBAE7941DB773A600E520CE /* UIView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIView.swift; sourceTree = ""; }; 129 | ECBAE7951DB773A600E520CE /* UIViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIViewController.swift; sourceTree = ""; }; 130 | ECBAE7961DB773A600E520CE /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 131 | ECD9E6D81BC24428001F8738 /* MLSwiftUtils.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MLSwiftUtils.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 132 | EDED78491C4F0F2B41A9E9B0 /* Pods-Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig"; sourceTree = ""; }; 133 | /* End PBXFileReference section */ 134 | 135 | /* Begin PBXFrameworksBuildPhase section */ 136 | EC45F2811D92A26F00A26AF0 /* Frameworks */ = { 137 | isa = PBXFrameworksBuildPhase; 138 | buildActionMask = 2147483647; 139 | files = ( 140 | B204CC319B099051C03BDD4C /* Pods_PodTest.framework in Frameworks */, 141 | ); 142 | runOnlyForDeploymentPostprocessing = 0; 143 | }; 144 | ECA6D5D21C83E68E00A3D848 /* Frameworks */ = { 145 | isa = PBXFrameworksBuildPhase; 146 | buildActionMask = 2147483647; 147 | files = ( 148 | ECA6D5DA1C83E68E00A3D848 /* MLSwiftUtils.framework in Frameworks */, 149 | 12C986317B77D7ABFB3C3C6F /* Pods_Tests.framework in Frameworks */, 150 | ); 151 | runOnlyForDeploymentPostprocessing = 0; 152 | }; 153 | ECD9E6D41BC24428001F8738 /* Frameworks */ = { 154 | isa = PBXFrameworksBuildPhase; 155 | buildActionMask = 2147483647; 156 | files = ( 157 | 9B0B04A766D90744A21FACC4 /* Pods_MLSwiftUtils.framework in Frameworks */, 158 | ); 159 | runOnlyForDeploymentPostprocessing = 0; 160 | }; 161 | /* End PBXFrameworksBuildPhase section */ 162 | 163 | /* Begin PBXGroup section */ 164 | 95562877CEECB0905E1E2050 /* Pods */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | 5A78C09A78B70F30AE14F808 /* Pods-PodTest.debug.xcconfig */, 168 | D36ADDDB6B5360976D618F19 /* Pods-PodTest.release.xcconfig */, 169 | 90CAB0307928F923616893B0 /* Pods-PodTest.releasetest.xcconfig */, 170 | E127B7F845E47BA2468CDBF1 /* Pods-SwiftUtils.debug.xcconfig */, 171 | 759E4A4DB4B0314C10C71ACD /* Pods-SwiftUtils.release.xcconfig */, 172 | 71476F41AA0C7E0C7C36A603 /* Pods-SwiftUtils.releasetest.xcconfig */, 173 | EDED78491C4F0F2B41A9E9B0 /* Pods-Tests.debug.xcconfig */, 174 | 024427016ED960227D9A8CC7 /* Pods-Tests.release.xcconfig */, 175 | BA6749A325B44D0D074C6081 /* Pods-Tests.releasetest.xcconfig */, 176 | 657BC397D02EF97097BADC6C /* Pods-MLSwiftUtils.debug.xcconfig */, 177 | BA65799C3A6863E6773DB55A /* Pods-MLSwiftUtils.release.xcconfig */, 178 | 12CA0CA242CAE5AFAAF2F3DB /* Pods-MLSwiftUtils.releasetest.xcconfig */, 179 | ); 180 | name = Pods; 181 | sourceTree = ""; 182 | }; 183 | EC41F5EA1D7BFE310081758D /* Data */ = { 184 | isa = PBXGroup; 185 | children = ( 186 | EC41F5EB1D7BFE4A0081758D /* TestView.swift */, 187 | EC41F5ED1D7BFE550081758D /* TestView.xib */, 188 | ); 189 | path = Data; 190 | sourceTree = ""; 191 | }; 192 | EC45F2851D92A26F00A26AF0 /* PodTest */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | EC45F2861D92A26F00A26AF0 /* AppDelegate.swift */, 196 | EC45F2881D92A26F00A26AF0 /* ViewController.swift */, 197 | EC45F28A1D92A26F00A26AF0 /* Main.storyboard */, 198 | EC45F28D1D92A26F00A26AF0 /* Assets.xcassets */, 199 | EC45F28F1D92A26F00A26AF0 /* LaunchScreen.storyboard */, 200 | EC45F2921D92A26F00A26AF0 /* Info.plist */, 201 | ); 202 | path = PodTest; 203 | sourceTree = ""; 204 | }; 205 | ECA6D5D61C83E68E00A3D848 /* Tests */ = { 206 | isa = PBXGroup; 207 | children = ( 208 | EC41F5EA1D7BFE310081758D /* Data */, 209 | ECA6D5D91C83E68E00A3D848 /* Info.plist */, 210 | ECA6D5E01C83E89B00A3D848 /* Array.swift */, 211 | EC7343EE1D05698C00FE3F92 /* Bool.swift */, 212 | EC21919B1D49D65000CA1314 /* String.swift */, 213 | EC41F5E81D7BFD820081758D /* UIView.swift */, 214 | ); 215 | path = Tests; 216 | sourceTree = ""; 217 | }; 218 | ECBAE7741DB773A600E520CE /* Sources */ = { 219 | isa = PBXGroup; 220 | children = ( 221 | ECBAE7751DB773A600E520CE /* Classes */, 222 | ECBAE77C1DB773A600E520CE /* Extensions */, 223 | ECBAE7961DB773A600E520CE /* Info.plist */, 224 | ); 225 | path = Sources; 226 | sourceTree = ""; 227 | }; 228 | ECBAE7751DB773A600E520CE /* Classes */ = { 229 | isa = PBXGroup; 230 | children = ( 231 | ECBAE7761DB773A600E520CE /* AlertController.swift */, 232 | ECBAE7771DB773A600E520CE /* Label.swift */, 233 | ECBAE7781DB773A600E520CE /* RefreshControl.swift */, 234 | ECBAE77A1DB773A600E520CE /* TableView.swift */, 235 | ); 236 | path = Classes; 237 | sourceTree = ""; 238 | }; 239 | ECBAE77C1DB773A600E520CE /* Extensions */ = { 240 | isa = PBXGroup; 241 | children = ( 242 | ECBAE77D1DB773A600E520CE /* Array.swift */, 243 | ECBAE77E1DB773A600E520CE /* Bool.swift */, 244 | ECBAE77F1DB773A600E520CE /* CGGeometry.swift */, 245 | ECBAE7801DB773A600E520CE /* Dictionary.swift */, 246 | ECBAE7811DB773A600E520CE /* Double.swift */, 247 | ECBAE7821DB773A600E520CE /* Float.swift */, 248 | ECBAE7831DB773A600E520CE /* Int.swift */, 249 | ECBAE7841DB773A600E520CE /* NSBundle.swift */, 250 | ECBAE7861DB773A600E520CE /* NSData.swift */, 251 | ECBAE7871DB773A600E520CE /* NSDate.swift */, 252 | ECBAE7881DB773A600E520CE /* NSFileManager.swift */, 253 | ECBAE7891DB773A600E520CE /* NSLock.swift */, 254 | ECBAE78A1DB773A600E520CE /* NSURL.swift */, 255 | ECBAE78B1DB773A600E520CE /* Range.swift */, 256 | ECBAE78C1DB773A600E520CE /* Regex.swift */, 257 | ECBAE78D1DB773A600E520CE /* String.swift */, 258 | ECBAE78E1DB773A600E520CE /* UICollectionView.swift */, 259 | ECBAE78F1DB773A600E520CE /* UIColor.swift */, 260 | ECBAE7901DB773A600E520CE /* UIGeometry.swift */, 261 | ECBAE7911DB773A600E520CE /* UIImage.swift */, 262 | ECBAE7921DB773A600E520CE /* UILayoutPriority.swift */, 263 | ECBAE7931DB773A600E520CE /* UITableView.swift */, 264 | ECBAE7941DB773A600E520CE /* UIView.swift */, 265 | ECBAE7951DB773A600E520CE /* UIViewController.swift */, 266 | ); 267 | path = Extensions; 268 | sourceTree = ""; 269 | }; 270 | ECD9E6CE1BC24428001F8738 = { 271 | isa = PBXGroup; 272 | children = ( 273 | ECBAE7741DB773A600E520CE /* Sources */, 274 | ECA6D5D61C83E68E00A3D848 /* Tests */, 275 | EC45F2851D92A26F00A26AF0 /* PodTest */, 276 | ECD9E6D91BC24428001F8738 /* Products */, 277 | F492F990E42B525FD024519F /* Frameworks */, 278 | 95562877CEECB0905E1E2050 /* Pods */, 279 | ); 280 | indentWidth = 4; 281 | sourceTree = ""; 282 | tabWidth = 4; 283 | }; 284 | ECD9E6D91BC24428001F8738 /* Products */ = { 285 | isa = PBXGroup; 286 | children = ( 287 | ECD9E6D81BC24428001F8738 /* MLSwiftUtils.framework */, 288 | ECA6D5D51C83E68E00A3D848 /* Tests.xctest */, 289 | EC45F2841D92A26F00A26AF0 /* PodTest.app */, 290 | ); 291 | name = Products; 292 | sourceTree = ""; 293 | }; 294 | F492F990E42B525FD024519F /* Frameworks */ = { 295 | isa = PBXGroup; 296 | children = ( 297 | CC90DFF29AB37B6D0DEBE45A /* Pods_PodTest.framework */, 298 | AD2BECCF992B0D91E960C280 /* Pods_Tests.framework */, 299 | 7BD268572D0CD479E99DA436 /* Pods_MLSwiftUtils.framework */, 300 | ); 301 | name = Frameworks; 302 | sourceTree = ""; 303 | }; 304 | /* End PBXGroup section */ 305 | 306 | /* Begin PBXHeadersBuildPhase section */ 307 | ECD9E6D51BC24428001F8738 /* Headers */ = { 308 | isa = PBXHeadersBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | }; 314 | /* End PBXHeadersBuildPhase section */ 315 | 316 | /* Begin PBXNativeTarget section */ 317 | EC45F2831D92A26F00A26AF0 /* PodTest */ = { 318 | isa = PBXNativeTarget; 319 | buildConfigurationList = EC45F2961D92A26F00A26AF0 /* Build configuration list for PBXNativeTarget "PodTest" */; 320 | buildPhases = ( 321 | A927849F26EAEA248B0C62BF /* [CP] Check Pods Manifest.lock */, 322 | EC45F2801D92A26F00A26AF0 /* Sources */, 323 | EC45F2811D92A26F00A26AF0 /* Frameworks */, 324 | EC45F2821D92A26F00A26AF0 /* Resources */, 325 | 30031D9544B626F63DAA2061 /* [CP] Embed Pods Frameworks */, 326 | ); 327 | buildRules = ( 328 | ); 329 | dependencies = ( 330 | ECE5D8A71DB8762B00193DD5 /* PBXTargetDependency */, 331 | ); 332 | name = PodTest; 333 | productName = PodTest; 334 | productReference = EC45F2841D92A26F00A26AF0 /* PodTest.app */; 335 | productType = "com.apple.product-type.application"; 336 | }; 337 | ECA6D5D41C83E68E00A3D848 /* Tests */ = { 338 | isa = PBXNativeTarget; 339 | buildConfigurationList = ECA6D5DF1C83E68E00A3D848 /* Build configuration list for PBXNativeTarget "Tests" */; 340 | buildPhases = ( 341 | 747DA2BBEED0102CB32F978B /* [CP] Check Pods Manifest.lock */, 342 | ECA6D5D11C83E68E00A3D848 /* Sources */, 343 | ECA6D5D21C83E68E00A3D848 /* Frameworks */, 344 | ECA6D5D31C83E68E00A3D848 /* Resources */, 345 | ); 346 | buildRules = ( 347 | ); 348 | dependencies = ( 349 | ECA6D5DC1C83E68E00A3D848 /* PBXTargetDependency */, 350 | ); 351 | name = Tests; 352 | productName = Tests; 353 | productReference = ECA6D5D51C83E68E00A3D848 /* Tests.xctest */; 354 | productType = "com.apple.product-type.bundle.unit-test"; 355 | }; 356 | ECD9E6D71BC24428001F8738 /* MLSwiftUtils */ = { 357 | isa = PBXNativeTarget; 358 | buildConfigurationList = ECD9E6E01BC24428001F8738 /* Build configuration list for PBXNativeTarget "MLSwiftUtils" */; 359 | buildPhases = ( 360 | F9DB3F586B76A7B756F7345A /* [CP] Check Pods Manifest.lock */, 361 | EC887CD71CA3DE3D00E04007 /* Swift-Lint */, 362 | ECD9E6D31BC24428001F8738 /* Sources */, 363 | ECD9E6D41BC24428001F8738 /* Frameworks */, 364 | ECD9E6D51BC24428001F8738 /* Headers */, 365 | ECD9E6D61BC24428001F8738 /* Resources */, 366 | ); 367 | buildRules = ( 368 | ); 369 | dependencies = ( 370 | ); 371 | name = MLSwiftUtils; 372 | productName = SwiftUtils; 373 | productReference = ECD9E6D81BC24428001F8738 /* MLSwiftUtils.framework */; 374 | productType = "com.apple.product-type.framework"; 375 | }; 376 | /* End PBXNativeTarget section */ 377 | 378 | /* Begin PBXProject section */ 379 | ECD9E6CF1BC24428001F8738 /* Project object */ = { 380 | isa = PBXProject; 381 | attributes = { 382 | BuildIndependentTargetsInParallel = YES; 383 | LastSwiftUpdateCheck = 0730; 384 | LastUpgradeCheck = 1620; 385 | ORGANIZATIONNAME = "Astraler Technology"; 386 | TargetAttributes = { 387 | EC45F2831D92A26F00A26AF0 = { 388 | CreatedOnToolsVersion = 7.3.1; 389 | DevelopmentTeam = 6KVPTGZPCD; 390 | LastSwiftMigration = 0910; 391 | ProvisioningStyle = Manual; 392 | }; 393 | ECA6D5D41C83E68E00A3D848 = { 394 | CreatedOnToolsVersion = 7.2.1; 395 | DevelopmentTeam = 2T879AQ94V; 396 | LastSwiftMigration = 1000; 397 | ProvisioningStyle = Manual; 398 | }; 399 | ECD9E6D71BC24428001F8738 = { 400 | CreatedOnToolsVersion = 7.0; 401 | LastSwiftMigration = 1000; 402 | }; 403 | }; 404 | }; 405 | buildConfigurationList = ECD9E6D21BC24428001F8738 /* Build configuration list for PBXProject "MLSwiftUtils" */; 406 | compatibilityVersion = "Xcode 3.2"; 407 | developmentRegion = en; 408 | hasScannedForEncodings = 0; 409 | knownRegions = ( 410 | Base, 411 | en, 412 | ); 413 | mainGroup = ECD9E6CE1BC24428001F8738; 414 | productRefGroup = ECD9E6D91BC24428001F8738 /* Products */; 415 | projectDirPath = ""; 416 | projectRoot = ""; 417 | targets = ( 418 | ECD9E6D71BC24428001F8738 /* MLSwiftUtils */, 419 | ECA6D5D41C83E68E00A3D848 /* Tests */, 420 | EC45F2831D92A26F00A26AF0 /* PodTest */, 421 | ); 422 | }; 423 | /* End PBXProject section */ 424 | 425 | /* Begin PBXResourcesBuildPhase section */ 426 | EC45F2821D92A26F00A26AF0 /* Resources */ = { 427 | isa = PBXResourcesBuildPhase; 428 | buildActionMask = 2147483647; 429 | files = ( 430 | EC45F2911D92A26F00A26AF0 /* LaunchScreen.storyboard in Resources */, 431 | EC45F28E1D92A26F00A26AF0 /* Assets.xcassets in Resources */, 432 | EC45F28C1D92A26F00A26AF0 /* Main.storyboard in Resources */, 433 | ); 434 | runOnlyForDeploymentPostprocessing = 0; 435 | }; 436 | ECA6D5D31C83E68E00A3D848 /* Resources */ = { 437 | isa = PBXResourcesBuildPhase; 438 | buildActionMask = 2147483647; 439 | files = ( 440 | EC41F5EE1D7BFE550081758D /* TestView.xib in Resources */, 441 | ); 442 | runOnlyForDeploymentPostprocessing = 0; 443 | }; 444 | ECD9E6D61BC24428001F8738 /* Resources */ = { 445 | isa = PBXResourcesBuildPhase; 446 | buildActionMask = 2147483647; 447 | files = ( 448 | ); 449 | runOnlyForDeploymentPostprocessing = 0; 450 | }; 451 | /* End PBXResourcesBuildPhase section */ 452 | 453 | /* Begin PBXShellScriptBuildPhase section */ 454 | 30031D9544B626F63DAA2061 /* [CP] Embed Pods Frameworks */ = { 455 | isa = PBXShellScriptBuildPhase; 456 | buildActionMask = 2147483647; 457 | files = ( 458 | ); 459 | inputPaths = ( 460 | "${PODS_ROOT}/Target Support Files/Pods-PodTest/Pods-PodTest-frameworks.sh", 461 | "${BUILT_PRODUCTS_DIR}/MLSwiftUtils/MLSwiftUtils.framework", 462 | ); 463 | name = "[CP] Embed Pods Frameworks"; 464 | outputPaths = ( 465 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MLSwiftUtils.framework", 466 | ); 467 | runOnlyForDeploymentPostprocessing = 0; 468 | shellPath = /bin/sh; 469 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PodTest/Pods-PodTest-frameworks.sh\"\n"; 470 | showEnvVarsInLog = 0; 471 | }; 472 | 747DA2BBEED0102CB32F978B /* [CP] Check Pods Manifest.lock */ = { 473 | isa = PBXShellScriptBuildPhase; 474 | buildActionMask = 2147483647; 475 | files = ( 476 | ); 477 | inputPaths = ( 478 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 479 | "${PODS_ROOT}/Manifest.lock", 480 | ); 481 | name = "[CP] Check Pods Manifest.lock"; 482 | outputPaths = ( 483 | "$(DERIVED_FILE_DIR)/Pods-Tests-checkManifestLockResult.txt", 484 | ); 485 | runOnlyForDeploymentPostprocessing = 0; 486 | shellPath = /bin/sh; 487 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 488 | showEnvVarsInLog = 0; 489 | }; 490 | A927849F26EAEA248B0C62BF /* [CP] Check Pods Manifest.lock */ = { 491 | isa = PBXShellScriptBuildPhase; 492 | buildActionMask = 2147483647; 493 | files = ( 494 | ); 495 | inputPaths = ( 496 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 497 | "${PODS_ROOT}/Manifest.lock", 498 | ); 499 | name = "[CP] Check Pods Manifest.lock"; 500 | outputPaths = ( 501 | "$(DERIVED_FILE_DIR)/Pods-PodTest-checkManifestLockResult.txt", 502 | ); 503 | runOnlyForDeploymentPostprocessing = 0; 504 | shellPath = /bin/sh; 505 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 506 | showEnvVarsInLog = 0; 507 | }; 508 | EC887CD71CA3DE3D00E04007 /* Swift-Lint */ = { 509 | isa = PBXShellScriptBuildPhase; 510 | alwaysOutOfDate = 1; 511 | buildActionMask = 2147483647; 512 | files = ( 513 | ); 514 | inputPaths = ( 515 | ); 516 | name = "Swift-Lint"; 517 | outputPaths = ( 518 | ); 519 | runOnlyForDeploymentPostprocessing = 0; 520 | shellPath = /bin/sh; 521 | shellScript = "\"${PODS_ROOT}/SwiftLint/swiftlint\"\n"; 522 | }; 523 | F9DB3F586B76A7B756F7345A /* [CP] Check Pods Manifest.lock */ = { 524 | isa = PBXShellScriptBuildPhase; 525 | buildActionMask = 2147483647; 526 | files = ( 527 | ); 528 | inputPaths = ( 529 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 530 | "${PODS_ROOT}/Manifest.lock", 531 | ); 532 | name = "[CP] Check Pods Manifest.lock"; 533 | outputPaths = ( 534 | "$(DERIVED_FILE_DIR)/Pods-MLSwiftUtils-checkManifestLockResult.txt", 535 | ); 536 | runOnlyForDeploymentPostprocessing = 0; 537 | shellPath = /bin/sh; 538 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 539 | showEnvVarsInLog = 0; 540 | }; 541 | /* End PBXShellScriptBuildPhase section */ 542 | 543 | /* Begin PBXSourcesBuildPhase section */ 544 | EC45F2801D92A26F00A26AF0 /* Sources */ = { 545 | isa = PBXSourcesBuildPhase; 546 | buildActionMask = 2147483647; 547 | files = ( 548 | EC45F2891D92A26F00A26AF0 /* ViewController.swift in Sources */, 549 | EC45F2871D92A26F00A26AF0 /* AppDelegate.swift in Sources */, 550 | ); 551 | runOnlyForDeploymentPostprocessing = 0; 552 | }; 553 | ECA6D5D11C83E68E00A3D848 /* Sources */ = { 554 | isa = PBXSourcesBuildPhase; 555 | buildActionMask = 2147483647; 556 | files = ( 557 | EC41F5E91D7BFD820081758D /* UIView.swift in Sources */, 558 | EC41F5EC1D7BFE4A0081758D /* TestView.swift in Sources */, 559 | ECA6D5E11C83E89B00A3D848 /* Array.swift in Sources */, 560 | EC21919C1D49D65000CA1314 /* String.swift in Sources */, 561 | EC7343EF1D05698C00FE3F92 /* Bool.swift in Sources */, 562 | ); 563 | runOnlyForDeploymentPostprocessing = 0; 564 | }; 565 | ECD9E6D31BC24428001F8738 /* Sources */ = { 566 | isa = PBXSourcesBuildPhase; 567 | buildActionMask = 2147483647; 568 | files = ( 569 | ECBAE7A81DB773A600E520CE /* NSFileManager.swift in Sources */, 570 | ECBAE7AD1DB773A600E520CE /* String.swift in Sources */, 571 | ECBAE7B21DB773A600E520CE /* UILayoutPriority.swift in Sources */, 572 | ECBAE7A31DB773A600E520CE /* Int.swift in Sources */, 573 | ECBAE7A61DB773A600E520CE /* NSData.swift in Sources */, 574 | ECBAE7B01DB773A600E520CE /* UIGeometry.swift in Sources */, 575 | ECBAE7B11DB773A600E520CE /* UIImage.swift in Sources */, 576 | ECBAE7A01DB773A600E520CE /* Dictionary.swift in Sources */, 577 | ECBAE7AE1DB773A600E520CE /* UICollectionView.swift in Sources */, 578 | ECBAE7B41DB773A600E520CE /* UIView.swift in Sources */, 579 | ECBAE79E1DB773A600E520CE /* Bool.swift in Sources */, 580 | ECBAE7AB1DB773A600E520CE /* Range.swift in Sources */, 581 | ECBAE79F1DB773A600E520CE /* CGGeometry.swift in Sources */, 582 | ECBAE7991DB773A600E520CE /* RefreshControl.swift in Sources */, 583 | ECBAE79D1DB773A600E520CE /* Array.swift in Sources */, 584 | ECBAE7AA1DB773A600E520CE /* NSURL.swift in Sources */, 585 | ECBAE79B1DB773A600E520CE /* TableView.swift in Sources */, 586 | ECBAE7A41DB773A600E520CE /* NSBundle.swift in Sources */, 587 | ECBAE7A91DB773A600E520CE /* NSLock.swift in Sources */, 588 | ECBAE7A21DB773A600E520CE /* Float.swift in Sources */, 589 | ECBAE7B31DB773A600E520CE /* UITableView.swift in Sources */, 590 | ECBAE7AF1DB773A600E520CE /* UIColor.swift in Sources */, 591 | ECBAE7981DB773A600E520CE /* Label.swift in Sources */, 592 | ECBAE7A71DB773A600E520CE /* NSDate.swift in Sources */, 593 | ECBAE7B51DB773A600E520CE /* UIViewController.swift in Sources */, 594 | ECBAE7A11DB773A600E520CE /* Double.swift in Sources */, 595 | ECBAE7971DB773A600E520CE /* AlertController.swift in Sources */, 596 | ECBAE7AC1DB773A600E520CE /* Regex.swift in Sources */, 597 | ); 598 | runOnlyForDeploymentPostprocessing = 0; 599 | }; 600 | /* End PBXSourcesBuildPhase section */ 601 | 602 | /* Begin PBXTargetDependency section */ 603 | ECA6D5DC1C83E68E00A3D848 /* PBXTargetDependency */ = { 604 | isa = PBXTargetDependency; 605 | target = ECD9E6D71BC24428001F8738 /* MLSwiftUtils */; 606 | targetProxy = ECA6D5DB1C83E68E00A3D848 /* PBXContainerItemProxy */; 607 | }; 608 | ECE5D8A71DB8762B00193DD5 /* PBXTargetDependency */ = { 609 | isa = PBXTargetDependency; 610 | target = ECD9E6D71BC24428001F8738 /* MLSwiftUtils */; 611 | targetProxy = ECE5D8A61DB8762B00193DD5 /* PBXContainerItemProxy */; 612 | }; 613 | /* End PBXTargetDependency section */ 614 | 615 | /* Begin PBXVariantGroup section */ 616 | EC45F28A1D92A26F00A26AF0 /* Main.storyboard */ = { 617 | isa = PBXVariantGroup; 618 | children = ( 619 | EC45F28B1D92A26F00A26AF0 /* Base */, 620 | ); 621 | name = Main.storyboard; 622 | sourceTree = ""; 623 | }; 624 | EC45F28F1D92A26F00A26AF0 /* LaunchScreen.storyboard */ = { 625 | isa = PBXVariantGroup; 626 | children = ( 627 | EC45F2901D92A26F00A26AF0 /* Base */, 628 | ); 629 | name = LaunchScreen.storyboard; 630 | sourceTree = ""; 631 | }; 632 | /* End PBXVariantGroup section */ 633 | 634 | /* Begin XCBuildConfiguration section */ 635 | EC45F2931D92A26F00A26AF0 /* Debug */ = { 636 | isa = XCBuildConfiguration; 637 | baseConfigurationReference = 5A78C09A78B70F30AE14F808 /* Pods-PodTest.debug.xcconfig */; 638 | buildSettings = { 639 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 640 | CLANG_ANALYZER_NONNULL = YES; 641 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 642 | DEVELOPMENT_TEAM = ""; 643 | INFOPLIST_FILE = PodTest/Info.plist; 644 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 645 | LD_RUNPATH_SEARCH_PATHS = ( 646 | "$(inherited)", 647 | "@executable_path/Frameworks", 648 | ); 649 | PRODUCT_BUNDLE_IDENTIFIER = vn.asiantech.test.PodTest; 650 | PRODUCT_NAME = "$(TARGET_NAME)"; 651 | PROVISIONING_PROFILE = ""; 652 | PROVISIONING_PROFILE_SPECIFIER = ""; 653 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 654 | SWIFT_VERSION = 5.0; 655 | }; 656 | name = Debug; 657 | }; 658 | EC45F2941D92A26F00A26AF0 /* Release */ = { 659 | isa = XCBuildConfiguration; 660 | baseConfigurationReference = D36ADDDB6B5360976D618F19 /* Pods-PodTest.release.xcconfig */; 661 | buildSettings = { 662 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 663 | CLANG_ANALYZER_NONNULL = YES; 664 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 665 | DEVELOPMENT_TEAM = ""; 666 | INFOPLIST_FILE = PodTest/Info.plist; 667 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 668 | LD_RUNPATH_SEARCH_PATHS = ( 669 | "$(inherited)", 670 | "@executable_path/Frameworks", 671 | ); 672 | PRODUCT_BUNDLE_IDENTIFIER = vn.asiantech.test.PodTest; 673 | PRODUCT_NAME = "$(TARGET_NAME)"; 674 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 675 | SWIFT_VERSION = 5.0; 676 | }; 677 | name = Release; 678 | }; 679 | EC45F2951D92A26F00A26AF0 /* ReleaseTest */ = { 680 | isa = XCBuildConfiguration; 681 | baseConfigurationReference = 90CAB0307928F923616893B0 /* Pods-PodTest.releasetest.xcconfig */; 682 | buildSettings = { 683 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 684 | CLANG_ANALYZER_NONNULL = YES; 685 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 686 | DEVELOPMENT_TEAM = ""; 687 | INFOPLIST_FILE = PodTest/Info.plist; 688 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 689 | LD_RUNPATH_SEARCH_PATHS = ( 690 | "$(inherited)", 691 | "@executable_path/Frameworks", 692 | ); 693 | PRODUCT_BUNDLE_IDENTIFIER = vn.asiantech.test.PodTest; 694 | PRODUCT_NAME = "$(TARGET_NAME)"; 695 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 696 | SWIFT_VERSION = 5.0; 697 | }; 698 | name = ReleaseTest; 699 | }; 700 | ECA6D5DD1C83E68E00A3D848 /* Debug */ = { 701 | isa = XCBuildConfiguration; 702 | baseConfigurationReference = EDED78491C4F0F2B41A9E9B0 /* Pods-Tests.debug.xcconfig */; 703 | buildSettings = { 704 | DEVELOPMENT_TEAM = ""; 705 | INFOPLIST_FILE = Tests/Info.plist; 706 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 707 | LD_RUNPATH_SEARCH_PATHS = ( 708 | "$(inherited)", 709 | "@executable_path/Frameworks", 710 | "@loader_path/Frameworks", 711 | ); 712 | PRODUCT_BUNDLE_IDENTIFIER = com.at.dev.Tests; 713 | PRODUCT_NAME = "$(TARGET_NAME)"; 714 | SWIFT_VERSION = 5.0; 715 | }; 716 | name = Debug; 717 | }; 718 | ECA6D5DE1C83E68E00A3D848 /* Release */ = { 719 | isa = XCBuildConfiguration; 720 | baseConfigurationReference = 024427016ED960227D9A8CC7 /* Pods-Tests.release.xcconfig */; 721 | buildSettings = { 722 | DEVELOPMENT_TEAM = ""; 723 | INFOPLIST_FILE = Tests/Info.plist; 724 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 725 | LD_RUNPATH_SEARCH_PATHS = ( 726 | "$(inherited)", 727 | "@executable_path/Frameworks", 728 | "@loader_path/Frameworks", 729 | ); 730 | PRODUCT_BUNDLE_IDENTIFIER = com.at.dev.Tests; 731 | PRODUCT_NAME = "$(TARGET_NAME)"; 732 | SWIFT_VERSION = 5.0; 733 | }; 734 | name = Release; 735 | }; 736 | ECD9E6DE1BC24428001F8738 /* Debug */ = { 737 | isa = XCBuildConfiguration; 738 | buildSettings = { 739 | ALWAYS_SEARCH_USER_PATHS = NO; 740 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 741 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 742 | CLANG_CXX_LIBRARY = "libc++"; 743 | CLANG_ENABLE_MODULES = YES; 744 | CLANG_ENABLE_OBJC_ARC = YES; 745 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 746 | CLANG_WARN_BOOL_CONVERSION = YES; 747 | CLANG_WARN_COMMA = YES; 748 | CLANG_WARN_CONSTANT_CONVERSION = YES; 749 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 750 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 751 | CLANG_WARN_EMPTY_BODY = YES; 752 | CLANG_WARN_ENUM_CONVERSION = YES; 753 | CLANG_WARN_INFINITE_RECURSION = YES; 754 | CLANG_WARN_INT_CONVERSION = YES; 755 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 756 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 757 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 758 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 759 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 760 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 761 | CLANG_WARN_STRICT_PROTOTYPES = YES; 762 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 763 | CLANG_WARN_UNREACHABLE_CODE = YES; 764 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 765 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 766 | COPY_PHASE_STRIP = NO; 767 | CURRENT_PROJECT_VERSION = 1; 768 | DEBUG_INFORMATION_FORMAT = dwarf; 769 | ENABLE_STRICT_OBJC_MSGSEND = YES; 770 | ENABLE_TESTABILITY = YES; 771 | GCC_C_LANGUAGE_STANDARD = gnu99; 772 | GCC_DYNAMIC_NO_PIC = NO; 773 | GCC_NO_COMMON_BLOCKS = YES; 774 | GCC_OPTIMIZATION_LEVEL = 0; 775 | GCC_PREPROCESSOR_DEFINITIONS = ( 776 | "DEBUG=1", 777 | "$(inherited)", 778 | ); 779 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 780 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 781 | GCC_WARN_UNDECLARED_SELECTOR = YES; 782 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 783 | GCC_WARN_UNUSED_FUNCTION = YES; 784 | GCC_WARN_UNUSED_VARIABLE = YES; 785 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 786 | MTL_ENABLE_DEBUG_INFO = YES; 787 | ONLY_ACTIVE_ARCH = YES; 788 | SDKROOT = iphoneos; 789 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 790 | SWIFT_VERSION = 5.0; 791 | TARGETED_DEVICE_FAMILY = "1,2"; 792 | VERSIONING_SYSTEM = "apple-generic"; 793 | VERSION_INFO_PREFIX = ""; 794 | }; 795 | name = Debug; 796 | }; 797 | ECD9E6DF1BC24428001F8738 /* Release */ = { 798 | isa = XCBuildConfiguration; 799 | buildSettings = { 800 | ALWAYS_SEARCH_USER_PATHS = NO; 801 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 802 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 803 | CLANG_CXX_LIBRARY = "libc++"; 804 | CLANG_ENABLE_MODULES = YES; 805 | CLANG_ENABLE_OBJC_ARC = YES; 806 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 807 | CLANG_WARN_BOOL_CONVERSION = YES; 808 | CLANG_WARN_COMMA = YES; 809 | CLANG_WARN_CONSTANT_CONVERSION = YES; 810 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 811 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 812 | CLANG_WARN_EMPTY_BODY = YES; 813 | CLANG_WARN_ENUM_CONVERSION = YES; 814 | CLANG_WARN_INFINITE_RECURSION = YES; 815 | CLANG_WARN_INT_CONVERSION = YES; 816 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 817 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 818 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 819 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 820 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 821 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 822 | CLANG_WARN_STRICT_PROTOTYPES = YES; 823 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 824 | CLANG_WARN_UNREACHABLE_CODE = YES; 825 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 826 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 827 | COPY_PHASE_STRIP = NO; 828 | CURRENT_PROJECT_VERSION = 1; 829 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 830 | ENABLE_NS_ASSERTIONS = NO; 831 | ENABLE_STRICT_OBJC_MSGSEND = YES; 832 | GCC_C_LANGUAGE_STANDARD = gnu99; 833 | GCC_NO_COMMON_BLOCKS = YES; 834 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 835 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 836 | GCC_WARN_UNDECLARED_SELECTOR = YES; 837 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 838 | GCC_WARN_UNUSED_FUNCTION = YES; 839 | GCC_WARN_UNUSED_VARIABLE = YES; 840 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 841 | MTL_ENABLE_DEBUG_INFO = NO; 842 | SDKROOT = iphoneos; 843 | SWIFT_COMPILATION_MODE = wholemodule; 844 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 845 | SWIFT_VERSION = 5.0; 846 | TARGETED_DEVICE_FAMILY = "1,2"; 847 | VALIDATE_PRODUCT = YES; 848 | VERSIONING_SYSTEM = "apple-generic"; 849 | VERSION_INFO_PREFIX = ""; 850 | }; 851 | name = Release; 852 | }; 853 | ECD9E6E11BC24428001F8738 /* Debug */ = { 854 | isa = XCBuildConfiguration; 855 | baseConfigurationReference = 657BC397D02EF97097BADC6C /* Pods-MLSwiftUtils.debug.xcconfig */; 856 | buildSettings = { 857 | CLANG_ENABLE_MODULES = YES; 858 | CODE_SIGN_IDENTITY = ""; 859 | DEFINES_MODULE = YES; 860 | DYLIB_COMPATIBILITY_VERSION = 1; 861 | DYLIB_CURRENT_VERSION = 1; 862 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 863 | ENABLE_MODULE_VERIFIER = YES; 864 | INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; 865 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 866 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 867 | LD_RUNPATH_SEARCH_PATHS = ( 868 | "$(inherited)", 869 | "@executable_path/Frameworks", 870 | "@loader_path/Frameworks", 871 | ); 872 | MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; 873 | PRODUCT_BUNDLE_IDENTIFIER = com.astraler.SwiftUtils; 874 | PRODUCT_NAME = "$(TARGET_NAME)"; 875 | SKIP_INSTALL = YES; 876 | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; 877 | SUPPORTS_MACCATALYST = NO; 878 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; 879 | SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; 880 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 881 | SWIFT_VERSION = 5.0; 882 | TARGETED_DEVICE_FAMILY = "1,2"; 883 | }; 884 | name = Debug; 885 | }; 886 | ECD9E6E21BC24428001F8738 /* Release */ = { 887 | isa = XCBuildConfiguration; 888 | baseConfigurationReference = BA65799C3A6863E6773DB55A /* Pods-MLSwiftUtils.release.xcconfig */; 889 | buildSettings = { 890 | CLANG_ENABLE_MODULES = YES; 891 | CODE_SIGN_IDENTITY = ""; 892 | DEFINES_MODULE = YES; 893 | DYLIB_COMPATIBILITY_VERSION = 1; 894 | DYLIB_CURRENT_VERSION = 1; 895 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 896 | ENABLE_MODULE_VERIFIER = YES; 897 | INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; 898 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 899 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 900 | LD_RUNPATH_SEARCH_PATHS = ( 901 | "$(inherited)", 902 | "@executable_path/Frameworks", 903 | "@loader_path/Frameworks", 904 | ); 905 | MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; 906 | PRODUCT_BUNDLE_IDENTIFIER = com.astraler.SwiftUtils; 907 | PRODUCT_NAME = "$(TARGET_NAME)"; 908 | SKIP_INSTALL = YES; 909 | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; 910 | SUPPORTS_MACCATALYST = NO; 911 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; 912 | SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; 913 | SWIFT_VERSION = 5.0; 914 | TARGETED_DEVICE_FAMILY = "1,2"; 915 | }; 916 | name = Release; 917 | }; 918 | ECDE5BE41CC7C7F200D613C7 /* ReleaseTest */ = { 919 | isa = XCBuildConfiguration; 920 | buildSettings = { 921 | ALWAYS_SEARCH_USER_PATHS = NO; 922 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 923 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 924 | CLANG_CXX_LIBRARY = "libc++"; 925 | CLANG_ENABLE_MODULES = YES; 926 | CLANG_ENABLE_OBJC_ARC = YES; 927 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 928 | CLANG_WARN_BOOL_CONVERSION = YES; 929 | CLANG_WARN_COMMA = YES; 930 | CLANG_WARN_CONSTANT_CONVERSION = YES; 931 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 932 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 933 | CLANG_WARN_EMPTY_BODY = YES; 934 | CLANG_WARN_ENUM_CONVERSION = YES; 935 | CLANG_WARN_INFINITE_RECURSION = YES; 936 | CLANG_WARN_INT_CONVERSION = YES; 937 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 938 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 939 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 940 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 941 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 942 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 943 | CLANG_WARN_STRICT_PROTOTYPES = YES; 944 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 945 | CLANG_WARN_UNREACHABLE_CODE = YES; 946 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 947 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 948 | COPY_PHASE_STRIP = NO; 949 | CURRENT_PROJECT_VERSION = 1; 950 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 951 | ENABLE_NS_ASSERTIONS = NO; 952 | ENABLE_STRICT_OBJC_MSGSEND = YES; 953 | ENABLE_TESTABILITY = YES; 954 | GCC_C_LANGUAGE_STANDARD = gnu99; 955 | GCC_NO_COMMON_BLOCKS = YES; 956 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 957 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 958 | GCC_WARN_UNDECLARED_SELECTOR = YES; 959 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 960 | GCC_WARN_UNUSED_FUNCTION = YES; 961 | GCC_WARN_UNUSED_VARIABLE = YES; 962 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 963 | MTL_ENABLE_DEBUG_INFO = NO; 964 | SDKROOT = iphoneos; 965 | SWIFT_COMPILATION_MODE = wholemodule; 966 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 967 | SWIFT_VERSION = 5.0; 968 | TARGETED_DEVICE_FAMILY = "1,2"; 969 | VALIDATE_PRODUCT = YES; 970 | VERSIONING_SYSTEM = "apple-generic"; 971 | VERSION_INFO_PREFIX = ""; 972 | }; 973 | name = ReleaseTest; 974 | }; 975 | ECDE5BE51CC7C7F200D613C7 /* ReleaseTest */ = { 976 | isa = XCBuildConfiguration; 977 | baseConfigurationReference = 12CA0CA242CAE5AFAAF2F3DB /* Pods-MLSwiftUtils.releasetest.xcconfig */; 978 | buildSettings = { 979 | CLANG_ENABLE_MODULES = YES; 980 | CODE_SIGN_IDENTITY = ""; 981 | DEFINES_MODULE = YES; 982 | DYLIB_COMPATIBILITY_VERSION = 1; 983 | DYLIB_CURRENT_VERSION = 1; 984 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 985 | ENABLE_MODULE_VERIFIER = YES; 986 | INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; 987 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 988 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 989 | LD_RUNPATH_SEARCH_PATHS = ( 990 | "$(inherited)", 991 | "@executable_path/Frameworks", 992 | "@loader_path/Frameworks", 993 | ); 994 | MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; 995 | PRODUCT_BUNDLE_IDENTIFIER = com.astraler.SwiftUtils; 996 | PRODUCT_NAME = "$(TARGET_NAME)"; 997 | SKIP_INSTALL = YES; 998 | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; 999 | SUPPORTS_MACCATALYST = NO; 1000 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; 1001 | SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; 1002 | SWIFT_VERSION = 5.0; 1003 | TARGETED_DEVICE_FAMILY = "1,2"; 1004 | }; 1005 | name = ReleaseTest; 1006 | }; 1007 | ECDE5BE61CC7C7F200D613C7 /* ReleaseTest */ = { 1008 | isa = XCBuildConfiguration; 1009 | baseConfigurationReference = BA6749A325B44D0D074C6081 /* Pods-Tests.releasetest.xcconfig */; 1010 | buildSettings = { 1011 | DEVELOPMENT_TEAM = ""; 1012 | INFOPLIST_FILE = Tests/Info.plist; 1013 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 1014 | LD_RUNPATH_SEARCH_PATHS = ( 1015 | "$(inherited)", 1016 | "@executable_path/Frameworks", 1017 | "@loader_path/Frameworks", 1018 | ); 1019 | PRODUCT_BUNDLE_IDENTIFIER = com.at.dev.Tests; 1020 | PRODUCT_NAME = "$(TARGET_NAME)"; 1021 | SWIFT_VERSION = 5.0; 1022 | }; 1023 | name = ReleaseTest; 1024 | }; 1025 | /* End XCBuildConfiguration section */ 1026 | 1027 | /* Begin XCConfigurationList section */ 1028 | EC45F2961D92A26F00A26AF0 /* Build configuration list for PBXNativeTarget "PodTest" */ = { 1029 | isa = XCConfigurationList; 1030 | buildConfigurations = ( 1031 | EC45F2931D92A26F00A26AF0 /* Debug */, 1032 | EC45F2941D92A26F00A26AF0 /* Release */, 1033 | EC45F2951D92A26F00A26AF0 /* ReleaseTest */, 1034 | ); 1035 | defaultConfigurationIsVisible = 0; 1036 | defaultConfigurationName = Release; 1037 | }; 1038 | ECA6D5DF1C83E68E00A3D848 /* Build configuration list for PBXNativeTarget "Tests" */ = { 1039 | isa = XCConfigurationList; 1040 | buildConfigurations = ( 1041 | ECA6D5DD1C83E68E00A3D848 /* Debug */, 1042 | ECA6D5DE1C83E68E00A3D848 /* Release */, 1043 | ECDE5BE61CC7C7F200D613C7 /* ReleaseTest */, 1044 | ); 1045 | defaultConfigurationIsVisible = 0; 1046 | defaultConfigurationName = Release; 1047 | }; 1048 | ECD9E6D21BC24428001F8738 /* Build configuration list for PBXProject "MLSwiftUtils" */ = { 1049 | isa = XCConfigurationList; 1050 | buildConfigurations = ( 1051 | ECD9E6DE1BC24428001F8738 /* Debug */, 1052 | ECD9E6DF1BC24428001F8738 /* Release */, 1053 | ECDE5BE41CC7C7F200D613C7 /* ReleaseTest */, 1054 | ); 1055 | defaultConfigurationIsVisible = 0; 1056 | defaultConfigurationName = Release; 1057 | }; 1058 | ECD9E6E01BC24428001F8738 /* Build configuration list for PBXNativeTarget "MLSwiftUtils" */ = { 1059 | isa = XCConfigurationList; 1060 | buildConfigurations = ( 1061 | ECD9E6E11BC24428001F8738 /* Debug */, 1062 | ECD9E6E21BC24428001F8738 /* Release */, 1063 | ECDE5BE51CC7C7F200D613C7 /* ReleaseTest */, 1064 | ); 1065 | defaultConfigurationIsVisible = 0; 1066 | defaultConfigurationName = Release; 1067 | }; 1068 | /* End XCConfigurationList section */ 1069 | }; 1070 | rootObject = ECD9E6CF1BC24428001F8738 /* Project object */; 1071 | } 1072 | -------------------------------------------------------------------------------- /MLSwiftUtils.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MLSwiftUtils.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MLSwiftUtils.xcodeproj/xcshareddata/xcschemes/MLSwiftUtils.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 51 | 52 | 53 | 54 | 55 | 56 | 66 | 67 | 73 | 74 | 80 | 81 | 82 | 83 | 85 | 86 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /MLSwiftUtils.xcodeproj/xcshareddata/xcschemes/PodTest.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 51 | 52 | 53 | 54 | 55 | 56 | 66 | 67 | 73 | 74 | 80 | 81 | 82 | 83 | 85 | 86 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /MLSwiftUtils.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /MLSwiftUtils.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MLSwiftUtils.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /PodTest/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // PodTest 4 | // 5 | // Created by DaoNV on 9/21/16. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import MLSwiftUtils 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { 18 | return true 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /PodTest/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /PodTest/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 | 29 | -------------------------------------------------------------------------------- /PodTest/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 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /PodTest/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 | 4.2 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 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /PodTest/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // PodTest 4 | // 5 | // Created by DaoNV on 9/21/16. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import MLSwiftUtils 11 | 12 | class ViewController: UIViewController { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '14.0' 2 | use_frameworks! 3 | inhibit_all_warnings! 4 | 5 | target 'PodTest' do 6 | pod 'MLSwiftUtils', :path => './' 7 | end 8 | 9 | target 'MLSwiftUtils' do 10 | pod 'SwiftLint' 11 | target 'Tests' do 12 | inherit! :search_paths 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MLSwiftUtils (5.0.0) 3 | - SwiftLint (0.59.1) 4 | 5 | DEPENDENCIES: 6 | - MLSwiftUtils (from `./`) 7 | - SwiftLint 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - SwiftLint 12 | 13 | EXTERNAL SOURCES: 14 | MLSwiftUtils: 15 | :path: "./" 16 | 17 | SPEC CHECKSUMS: 18 | MLSwiftUtils: 57d103407910f01c648d41a0cf7b6b8c57f7bad5 19 | SwiftLint: 3d48e2fb2a3468fdaccf049e5e755df22fb40c2c 20 | 21 | PODFILE CHECKSUM: 0ad34f8cb20fc367df151910b130163c59a25d77 22 | 23 | COCOAPODS: 1.15.2 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [SwiftUtils](https://github.com/tsrnd/swiftutils-ios) 2 | ============ 3 | 4 | ## Requirements 5 | 6 | - iOS 14.0+ 7 | Version 4.2: - Xcode 10 ~ Swift 4.2+ 8 | 9 | ## Installation 10 | 11 | ### CocoaPods 12 | 13 | [CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: 14 | 15 | ```bash 16 | $ gem install cocoapods 17 | ``` 18 | 19 | > CocoaPods 1.2.0+ is required to build SwiftUtils 4.0+. 20 | 21 | To integrate SwiftUtils into your Xcode project using CocoaPods, specify it in your `Podfile`: 22 | 23 | ```ruby 24 | platform :ios, '14.0' 25 | use_frameworks! 26 | 27 | pod 'SwiftUtils', '5.0.0' 28 | ``` 29 | 30 | Then, run the following command: 31 | 32 | ```bash 33 | $ pod install 34 | ``` 35 | -------------------------------------------------------------------------------- /Sources/Classes/AlertController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertController.swift 3 | // TimorAir 4 | // 5 | // Created by DaoNV on 8/23/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public enum AlertLevel: Int { 12 | case low 13 | case normal 14 | case high 15 | case require 16 | } 17 | 18 | public protocol AlertLevelProtocol: AnyObject { 19 | var level: AlertLevel { get } 20 | func dismiss(animated: Bool, completion: (() -> Void)?) 21 | } 22 | 23 | open class AlertController: UIAlertController, AlertLevelProtocol { 24 | 25 | open var level = AlertLevel.normal 26 | 27 | // Recommend `present` method for AlertController instead of default is `presentViewController`. 28 | open func present(from: UIViewController? = nil, animated: Bool = true, completion: (() -> Void)? = nil) { 29 | if let from = from, from.isViewLoaded { 30 | if let popup = from.presentedViewController { 31 | if let vc = popup as? AlertLevelProtocol { 32 | if level > vc.level { 33 | vc.dismiss(animated: animated, completion: { 34 | self.present(from: from, animated: animated, completion: completion) 35 | }) 36 | } 37 | } else if level > .normal { 38 | popup.dismiss(animated: animated, completion: { 39 | self.present(from: from, animated: animated, completion: completion) 40 | }) 41 | } 42 | } else { 43 | from.present(self, animated: animated, completion: completion) 44 | } 45 | } else if let root = UIApplication.shared.delegate?.window??.rootViewController, root.isViewLoaded { 46 | present(from: root, animated: animated, completion: completion) 47 | } 48 | } 49 | 50 | open func dismiss(_ animated: Bool = true, completion: (() -> Void)? = nil) { 51 | dismiss(animated: animated, completion: completion) 52 | } 53 | } 54 | 55 | public func == (lhs: AlertLevel, rhs: AlertLevel) -> Bool { 56 | return lhs.rawValue == rhs.rawValue 57 | } 58 | 59 | public func > (lhs: AlertLevel, rhs: AlertLevel) -> Bool { 60 | return lhs.rawValue > rhs.rawValue 61 | } 62 | 63 | public func >= (lhs: AlertLevel, rhs: AlertLevel) -> Bool { 64 | return lhs.rawValue >= rhs.rawValue 65 | } 66 | 67 | public func < (lhs: AlertLevel, rhs: AlertLevel) -> Bool { 68 | return lhs.rawValue < rhs.rawValue 69 | } 70 | 71 | public func <= (lhs: AlertLevel, rhs: AlertLevel) -> Bool { 72 | return lhs.rawValue <= rhs.rawValue 73 | } 74 | -------------------------------------------------------------------------------- /Sources/Classes/Label.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Label.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/5/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class Label: UILabel { 12 | 13 | open var edgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) 14 | 15 | override open func textRect(forBounds bounds: CGRect, limitedToNumberOfLines numberOfLines: Int) -> CGRect { 16 | var rect = edgeInsets.inset(bounds) 17 | rect = super.textRect(forBounds: rect, limitedToNumberOfLines: numberOfLines) 18 | return edgeInsets.inverse.inset(rect) 19 | } 20 | 21 | override open func drawText(in rect: CGRect) { 22 | super.drawText(in: edgeInsets.inset(rect)) 23 | } 24 | 25 | open override var intrinsicContentSize: CGSize { 26 | var size = super.intrinsicContentSize 27 | size.width += (edgeInsets.left + edgeInsets.right) 28 | size.height += (edgeInsets.top + edgeInsets.bottom) 29 | return size 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sources/Classes/RefreshControl.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RefreshControl.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 5/7/16. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class RefreshControl: UIRefreshControl { 12 | 13 | override open func endRefreshing() { 14 | let scrollView = superview as? UIScrollView 15 | let scrollEnabled = scrollView?.isScrollEnabled ?? true 16 | scrollView?.isScrollEnabled = false 17 | super.endRefreshing() 18 | scrollView?.isScrollEnabled = scrollEnabled 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sources/Classes/TableView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TableView.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/5/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class TableView: UITableView { 12 | 13 | open var allowHeaderViewsToFloat: Bool = false 14 | open var allowFooterViewsToFloat: Bool = false 15 | 16 | open func allowsHeaderViewsToFloat() -> Bool { 17 | return allowHeaderViewsToFloat 18 | } 19 | 20 | open func allowsFooterViewsToFloat() -> Bool { 21 | return allowFooterViewsToFloat 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sources/Extensions/Array.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Array.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension Array { 12 | 13 | public mutating func shuffle() { 14 | for i in (1 ..< count).reversed() { 15 | let j = Int.random(max: i - 1) 16 | swapAt(i, j) 17 | } 18 | } 19 | 20 | public func shuffled() -> [Element] { 21 | var array = self 22 | array.shuffle() 23 | return array 24 | } 25 | 26 | public func toJSONString() -> String? { 27 | guard let data = toJSONData() else { 28 | return nil 29 | } 30 | return String.init(data: data, encoding: .utf8) 31 | } 32 | 33 | public func toJSONData() -> Data? { 34 | do { 35 | let data = try JSONSerialization.data(withJSONObject: self, options: .prettyPrinted) 36 | return data 37 | } catch { 38 | return nil 39 | } 40 | } 41 | } 42 | 43 | extension Array where Element: Equatable { 44 | 45 | public mutating func remove(_ element: Element) -> Element? { 46 | guard let idx = firstIndex(of: element) else { 47 | return nil 48 | } 49 | return remove(at: idx) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Sources/Extensions/Bool.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Bool.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/8/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Bool { 12 | 13 | public func toInt() -> Int { 14 | return self ? 1 : 0 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Sources/Extensions/CGGeometry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGPoint.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/8/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension CGPoint { 12 | 13 | public var isZero: Bool { 14 | return x == 0 && y == 0 15 | } 16 | } 17 | 18 | public prefix func - (point: CGPoint) -> CGPoint { 19 | return CGPoint(x: -point.x, y: -point.y) 20 | } 21 | 22 | public func == (lhs: CGPoint, rhs: CGPoint) -> Bool { 23 | return lhs.x == rhs.x && lhs.y == rhs.y 24 | } 25 | 26 | public func += (lhs: inout CGPoint, rhs: CGPoint) -> CGPoint { 27 | lhs.x += rhs.x 28 | lhs.y += rhs.y 29 | return lhs 30 | } 31 | 32 | public func += (lhs: inout CGPoint, rhs: CGSize) -> CGPoint { 33 | lhs.x += rhs.width 34 | lhs.y += rhs.height 35 | return lhs 36 | } 37 | 38 | public func += (lhs: inout CGPoint, rhs: CGVector) -> CGPoint { 39 | lhs.x += rhs.dx 40 | lhs.y += rhs.dy 41 | return lhs 42 | } 43 | 44 | public func += (lhs: inout CGPoint, rhs: CGFloat) -> CGPoint { 45 | lhs.x += rhs 46 | lhs.y += rhs 47 | return lhs 48 | } 49 | 50 | public func + (lhs: CGPoint, rhs: CGPoint) -> CGPoint { 51 | return CGPoint(x: lhs.x + rhs.x, y: lhs.y + rhs.y) 52 | } 53 | 54 | public func + (lhs: CGPoint, rhs: CGSize) -> CGPoint { 55 | return CGPoint(x: lhs.x + rhs.width, y: lhs.y + rhs.height) 56 | } 57 | 58 | public func + (lhs: CGPoint, rhs: CGVector) -> CGPoint { 59 | return CGPoint(x: lhs.x + rhs.dx, y: lhs.y + rhs.dy) 60 | } 61 | 62 | public func + (lhs: CGPoint, rhs: CGFloat) -> CGPoint { 63 | return CGPoint(x: lhs.x + rhs, y: lhs.y + rhs) 64 | } 65 | 66 | public func -= (lhs: inout CGPoint, rhs: CGPoint) -> CGPoint { 67 | lhs.x -= rhs.x 68 | lhs.y -= rhs.y 69 | return lhs 70 | } 71 | 72 | public func -= (lhs: inout CGPoint, rhs: CGSize) -> CGPoint { 73 | return CGPoint(x: lhs.x - rhs.width, y: lhs.y - rhs.height) 74 | } 75 | 76 | public func -= (lhs: inout CGPoint, rhs: CGVector) -> CGPoint { 77 | lhs.x -= rhs.dx 78 | lhs.y -= rhs.dy 79 | return lhs 80 | } 81 | 82 | public func -= (lhs: inout CGPoint, rhs: CGFloat) -> CGPoint { 83 | lhs.x -= rhs 84 | lhs.y -= rhs 85 | return lhs 86 | } 87 | 88 | public func - (lhs: CGPoint, rhs: CGPoint) -> CGPoint { 89 | return CGPoint(x: lhs.x - rhs.x, y: lhs.y - rhs.y) 90 | } 91 | 92 | public func - (lhs: CGPoint, rhs: CGSize) -> CGPoint { 93 | return CGPoint(x: lhs.x - rhs.width, y: lhs.y - rhs.height) 94 | } 95 | 96 | public func - (lhs: CGPoint, rhs: CGVector) -> CGPoint { 97 | return CGPoint(x: lhs.x - rhs.dx, y: lhs.y - rhs.dy) 98 | } 99 | 100 | public func - (lhs: CGPoint, rhs: CGFloat) -> CGPoint { 101 | return CGPoint(x: lhs.x - rhs, y: lhs.y - rhs) 102 | } 103 | 104 | public func *= (lhs: inout CGPoint, rhs: CGFloat) -> CGPoint { 105 | lhs.x *= rhs 106 | lhs.y *= rhs 107 | return lhs 108 | } 109 | 110 | public func * (lhs: CGPoint, rhs: CGFloat) -> CGPoint { 111 | return CGPoint(x: lhs.x * rhs, y: lhs.y * rhs) 112 | } 113 | 114 | public func /= (lhs: inout CGPoint, rhs: CGFloat) -> CGPoint { 115 | lhs.x /= rhs 116 | lhs.y /= rhs 117 | return lhs 118 | } 119 | 120 | public func / (lhs: CGPoint, rhs: CGFloat) -> CGPoint { 121 | return CGPoint(x: lhs.x / rhs, y: lhs.y / rhs) 122 | } 123 | 124 | extension CGSize { 125 | 126 | public init(size: CGFloat) { 127 | self.init(width: size, height: size) 128 | } 129 | 130 | public var isZero: Bool { 131 | return width <= 0 || height <= 0 132 | } 133 | } 134 | 135 | public func += (lhs: inout CGSize, rhs: CGSize) -> CGSize { 136 | lhs.width += rhs.width 137 | lhs.height += rhs.height 138 | return lhs 139 | } 140 | 141 | public func + (lhs: CGSize, rhs: CGSize) -> CGSize { 142 | return CGSize(width: lhs.width + rhs.width, height: lhs.height + rhs.height) 143 | } 144 | 145 | public func -= (lhs: inout CGSize, rhs: CGSize) -> CGSize { 146 | lhs.width -= rhs.width 147 | lhs.height -= rhs.height 148 | return lhs 149 | } 150 | 151 | public func - (lhs: CGSize, rhs: CGSize) -> CGSize { 152 | return CGSize(width: lhs.width - rhs.width, height: lhs.height - rhs.height) 153 | } 154 | 155 | public func *= (lhs: inout CGSize, rhs: CGFloat) -> CGSize { 156 | lhs.width *= rhs 157 | lhs.height *= rhs 158 | return lhs 159 | } 160 | 161 | public func * (lhs: CGSize, rhs: CGFloat) -> CGSize { 162 | return CGSize(width: lhs.width * rhs, height: lhs.height * rhs) 163 | } 164 | 165 | public func /= (lhs: inout CGSize, rhs: CGFloat) -> CGSize { 166 | lhs.width /= rhs 167 | lhs.height /= rhs 168 | return lhs 169 | } 170 | 171 | public func / (lhs: CGSize, rhs: CGFloat) -> CGSize { 172 | return CGSize(width: lhs.width / rhs, height: lhs.height / rhs) 173 | } 174 | 175 | extension CGVector { 176 | 177 | public var isZero: Bool { 178 | return dx == 0 && dy == 0 179 | } 180 | } 181 | 182 | public prefix func - (lhs: CGVector) -> CGVector { 183 | return CGVector(dx: -lhs.dx, dy: -lhs.dy) 184 | } 185 | 186 | public func == (lhs: CGVector, rhs: CGVector) -> Bool { 187 | return lhs.dx == rhs.dx && lhs.dy == rhs.dy 188 | } 189 | 190 | public func + (lhs: CGVector, rhs: CGVector) -> CGVector { 191 | return CGVector(dx: lhs.dx + rhs.dx, dy: lhs.dy + rhs.dy) 192 | } 193 | 194 | public func += (lhs: inout CGVector, rhs: CGVector) -> CGVector { 195 | lhs.dx += rhs.dx 196 | lhs.dy += rhs.dy 197 | return lhs 198 | } 199 | 200 | public func - (lhs: CGVector, rhs: CGVector) -> CGVector { 201 | return CGVector(dx: lhs.dx - rhs.dx, dy: lhs.dy - rhs.dy) 202 | } 203 | 204 | public func * (lhs: CGVector, rhs: CGVector) -> CGFloat { 205 | return lhs.dx * rhs.dy + lhs.dy * rhs.dx 206 | } 207 | 208 | public func * (lhs: CGVector, rhs: CGFloat) -> CGVector { 209 | return CGVector(dx: lhs.dx * rhs, dy: lhs.dy * rhs) 210 | } 211 | 212 | public func / (lhs: CGVector, rhs: CGFloat) -> CGVector { 213 | return CGVector(dx: lhs.dx / rhs, dy: lhs.dy / rhs) 214 | } 215 | 216 | public func /= (lhs: inout CGVector, rhs: CGFloat) -> CGVector { 217 | lhs.dx /= rhs 218 | lhs.dy /= rhs 219 | return lhs 220 | } 221 | 222 | extension CGRect { 223 | 224 | public var mid: CGPoint { 225 | return CGPoint(x: midX, y: midY) 226 | } 227 | 228 | public var topLeft: CGPoint { 229 | return CGPoint(x: minX, y: minY) 230 | } 231 | 232 | public var topCenter: CGPoint { 233 | return CGPoint(x: midX, y: minY) 234 | } 235 | 236 | public var topRight: CGPoint { 237 | return CGPoint(x: maxX, y: minY) 238 | } 239 | 240 | public var bottomLeft: CGPoint { 241 | return CGPoint(x: minX, y: maxY) 242 | } 243 | 244 | public var bottomCenter: CGPoint { 245 | return CGPoint(x: midX, y: maxY) 246 | } 247 | 248 | public var bottomRight: CGPoint { 249 | return CGPoint(x: maxX, y: maxY) 250 | } 251 | } 252 | 253 | public func + (lhs: CGRect, rhs: CGPoint) -> CGRect { 254 | let origin = CGPoint(x: lhs.origin.x + rhs.x, y: lhs.origin.y + rhs.y) 255 | return CGRect(origin: origin, size: lhs.size) 256 | } 257 | 258 | public func + (lhs: CGRect, rhs: CGVector) -> CGRect { 259 | let origin = CGPoint(x: lhs.origin.x + rhs.dx, y: lhs.origin.y + rhs.dy) 260 | return CGRect(origin: origin, size: lhs.size) 261 | } 262 | 263 | public func + (lhs: CGRect, rhs: CGSize) -> CGRect { 264 | let size = CGSize(width: lhs.size.width + rhs.width, height: lhs.size.height + rhs.height) 265 | return CGRect(origin: lhs.origin, size: size) 266 | } 267 | 268 | public func - (lhs: CGRect, rhs: CGPoint) -> CGRect { 269 | let origin = CGPoint(x: lhs.origin.x - rhs.x, y: lhs.origin.y - rhs.y) 270 | return CGRect(origin: origin, size: lhs.size) 271 | } 272 | 273 | public func - (lhs: CGRect, rhs: CGVector) -> CGRect { 274 | let origin = CGPoint(x: lhs.origin.x - rhs.dx, y: lhs.origin.y - rhs.dy) 275 | return CGRect(origin: origin, size: lhs.size) 276 | } 277 | 278 | public func - (lhs: CGRect, rhs: CGSize) -> CGRect { 279 | let size = CGSize(width: lhs.size.width - rhs.width, height: lhs.size.height - rhs.height) 280 | return CGRect(origin: lhs.origin, size: size) 281 | } 282 | -------------------------------------------------------------------------------- /Sources/Extensions/Dictionary.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Dictionary.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Dictionary { 12 | 13 | public var allKeys: [Key] { 14 | return Array(keys) 15 | } 16 | 17 | public var allValues: [Value] { 18 | return Array(values) 19 | } 20 | 21 | public mutating func updateValues(_ dic: [Key: Value]?) { 22 | if let dic = dic { 23 | for (key, value) in dic { 24 | self[key] = value 25 | } 26 | } 27 | } 28 | 29 | public func hasKey(_ key: Key) -> Bool { 30 | return index(forKey: key) != nil 31 | } 32 | 33 | public func toJSONData() -> Data? { 34 | do { 35 | return try JSONSerialization.data(withJSONObject: self, options: JSONSerialization.WritingOptions.prettyPrinted) 36 | } catch { 37 | return nil 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Sources/Extensions/Double.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Double.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Double { 12 | 13 | public var abs: Double { 14 | return Foundation.fabs(self) 15 | } 16 | 17 | public var sqrt: Double { 18 | return Foundation.sqrt(self) 19 | } 20 | 21 | public var floor: Double { 22 | return Foundation.floor(self) 23 | } 24 | 25 | public var ceil: Double { 26 | return Foundation.ceil(self) 27 | } 28 | 29 | public var round: Double { 30 | return Foundation.round(self) 31 | } 32 | 33 | public func clamp(_ min: Double, _ max: Double) -> Double { 34 | return Swift.max(min, Swift.min(max, self)) 35 | } 36 | 37 | public static func random(min: Double = 0, max: Double) -> Double { 38 | let diff = max - min 39 | return Double.random(in: min...max) 40 | } 41 | 42 | public func distance(_ precision: Int = -1, meter: String = "m", kilometer: String = "km") -> String { // precision < 0: Auto 43 | var num = self 44 | var unit = meter 45 | if num > 1000.0 { 46 | unit = kilometer 47 | num /= 1000.0 48 | } 49 | if precision == -1 { 50 | if num == trunc(num) { 51 | return String(format: "%.0f%@", num, unit) 52 | } else { 53 | return String(format: "%.1f%@", num, unit) 54 | } 55 | } else { 56 | let format = "%.\(precision)f%@" 57 | return String(format: format, num, unit) 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Sources/Extensions/Float.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Float.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Float { 12 | 13 | public var abs: Float { 14 | return Foundation.fabsf(self) 15 | } 16 | 17 | public var sqrt: Float { 18 | return Foundation.sqrt(self) 19 | } 20 | 21 | public var floor: Float { 22 | return Foundation.floor(self) 23 | } 24 | 25 | public var ceil: Float { 26 | return Foundation.ceil(self) 27 | } 28 | 29 | public var round: Float { 30 | return Foundation.round(self) 31 | } 32 | 33 | public func clamp(_ min: Float, _ max: Float) -> Float { 34 | return Swift.max(min, Swift.min(max, self)) 35 | } 36 | 37 | public static func random(min: Float = 0, max: Float) -> Float { 38 | return Float.random(in: min...max) 39 | } 40 | 41 | public func distance(_ precision: Int = -1) -> String { // precision < 0: Auto 42 | var num = self 43 | var unit = "m" 44 | if num > 1000.0 { 45 | unit = "km" 46 | num /= 1000.0 47 | } 48 | if precision == -1 { 49 | if num == truncf(num) { 50 | return String(format: "%.0f%@", num, unit) 51 | } else { 52 | return String(format: "%.1f%@", num, unit) 53 | } 54 | } else { 55 | let format = "%.\(precision)f%@" 56 | return String(format: format, num, unit) 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Sources/Extensions/Int.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Int.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension Int { 12 | 13 | public func loop(_ block: () -> Void) { 14 | for _ in 0 ..< self { 15 | block() 16 | } 17 | } 18 | 19 | public var isEven: Bool { 20 | return (self % 2) == 0 21 | } 22 | 23 | public var isOdd: Bool { 24 | return (self % 2) == 1 25 | } 26 | 27 | public func clamp(_ range: Range) -> Int { 28 | return clamp(range.lowerBound, range.upperBound - 1) 29 | } 30 | 31 | public func clamp(_ min: Int, _ max: Int) -> Int { 32 | return Swift.max(min, Swift.min(max, self)) 33 | } 34 | 35 | public var digits: [Int] { 36 | var result = [Int]() 37 | for char in String(self) { 38 | let string = String(char) 39 | if let toInt = Int(string) { 40 | result.append(toInt) 41 | } 42 | } 43 | return result 44 | } 45 | 46 | public var abs: Int { 47 | return Swift.abs(self) 48 | } 49 | 50 | public func gcd(_ num: Int) -> Int { 51 | return num == 0 ? self : num.gcd(self % num) 52 | } 53 | 54 | public func lcm(_ num: Int) -> Int { 55 | return (self * num).abs / gcd(num) 56 | } 57 | 58 | public var factorial: Int { 59 | return self == 0 ? 1 : self * (self - 1).factorial 60 | } 61 | 62 | public var ordinal: String { 63 | let suffix: [String] = ["th", "st", "nd", "rd", "th"] 64 | var index = 0 65 | if self < 11 || self > 13 { 66 | index = Swift.min(suffix.count - 1, self % 10) 67 | } 68 | return String(format: "%zd%@", self, suffix[index]) 69 | } 70 | 71 | public static func random(min: Int = 0, max: Int) -> Int { 72 | Int.random(in: min...max) 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Sources/Extensions/NSBundle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSBundle.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 2/27/16. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public let kCFBundleDisplayNameKey = "CFBundleDisplayName" 12 | public let kCFBundleNameKey = "CFBundleName" 13 | public let kCFBundleShortVersionKey = "CFBundleShortVersionString" 14 | 15 | extension Bundle { 16 | 17 | public var name: String { 18 | guard let info = infoDictionary else { return "" } 19 | return info[kCFBundleDisplayNameKey] as? String ?? info[kCFBundleNameKey] as? String ?? "" 20 | } 21 | 22 | public var version: String { 23 | guard let info = infoDictionary else { return "" } 24 | return info[kCFBundleShortVersionKey] as? String ?? "" 25 | } 26 | 27 | public var build: String { 28 | guard let info = infoDictionary else { return "" } 29 | return info[kCFBundleVersionKey as String] as? String ?? "" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sources/Extensions/NSData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSData.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 12/30/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Data { 12 | 13 | public func toJSON() -> Any? { 14 | do { 15 | return try JSONSerialization.jsonObject(with: self, options: JSONSerialization.ReadingOptions.allowFragments) 16 | } catch { 17 | return nil 18 | } 19 | } 20 | 21 | public func toString(_ encoding: String.Encoding = String.Encoding.utf8) -> String? { 22 | return String(data: self, encoding: encoding) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/Extensions/NSDate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | private var _defaultCalendar = Calendar.current 12 | 13 | extension Calendar { 14 | 15 | public static func setDefaultCalendar(_ defaultCalendar: Calendar) { 16 | _defaultCalendar = defaultCalendar 17 | } 18 | 19 | public static func defaultCalendar() -> Calendar { 20 | return _defaultCalendar 21 | } 22 | } 23 | 24 | extension TimeZone { 25 | 26 | public static var UTC: TimeZone { 27 | return TimeZone(abbreviation: "UTC")! 28 | } 29 | } 30 | 31 | private var _defaultLocale = Locale.current 32 | 33 | extension Locale { 34 | 35 | public static func setDefaultLocale(_ defaultLocale: Locale) { 36 | _defaultLocale = defaultLocale 37 | } 38 | 39 | public static func defaultLocale() -> Locale { 40 | return _defaultLocale 41 | } 42 | } 43 | 44 | extension DateComponents { 45 | 46 | public init(year: Int, month: Int, day: Int, hour: Int = 0, minute: Int = 0, sec: Int = 0, nsec: Int = 0) { 47 | self.init() 48 | self.year = year 49 | self.month = month 50 | self.day = day 51 | self.hour = hour 52 | self.minute = minute 53 | self.second = sec 54 | self.nanosecond = nsec 55 | (self as NSDateComponents).calendar = Calendar.defaultCalendar() 56 | (self as NSDateComponents).timeZone = TimeZone.current 57 | } 58 | 59 | public init(hour: Int, minute: Int, sec: Int = 0, nsec: Int = 0) { 60 | self.init() 61 | self.year = 0 62 | self.month = 0 63 | self.day = 0 64 | self.hour = hour 65 | self.minute = minute 66 | self.second = sec 67 | self.nanosecond = nsec 68 | (self as NSDateComponents).calendar = Calendar.defaultCalendar() 69 | (self as NSDateComponents).timeZone = TimeZone.current 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Sources/Extensions/NSFileManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSFileManager.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/23/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension FileManager { 12 | 13 | public class var homeDir: String! { 14 | return NSHomeDirectory() 15 | } 16 | 17 | public class var homeUrl: URL! { 18 | return URL(fileURLWithPath: homeDir, isDirectory: true) 19 | } 20 | 21 | public class var docDir: String! { 22 | return NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first 23 | } 24 | 25 | public class var docUrl: URL! { 26 | return URL(fileURLWithPath: docDir, isDirectory: true) 27 | } 28 | 29 | public class var libraryDir: String! { 30 | return NSSearchPathForDirectoriesInDomains(.libraryDirectory, .userDomainMask, true).first 31 | } 32 | 33 | public class var libraryUrl: URL! { 34 | return URL(fileURLWithPath: libraryDir, isDirectory: true) 35 | } 36 | 37 | public class var appSupportDir: String! { 38 | return NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true).first 39 | } 40 | 41 | public class var appSupportUrl: URL! { 42 | return URL(fileURLWithPath: appSupportDir, isDirectory: true) 43 | } 44 | 45 | public class var tmpDir: String { 46 | return NSTemporaryDirectory() 47 | } 48 | 49 | public class var tmpUrl: URL { 50 | return URL(fileURLWithPath: tmpDir, isDirectory: true) 51 | } 52 | 53 | public class func skipBackup(_ path: String) -> Bool { 54 | let fileManager = `default` 55 | var isDir: ObjCBool = true 56 | if fileManager.fileExists(atPath: path, isDirectory: &isDir) { 57 | if isDir.boolValue { 58 | var success = true 59 | do { 60 | let urls = try fileManager.contentsOfDirectory(atPath: path) 61 | for url in urls { 62 | success = success && skipBackup(url) 63 | } 64 | return success 65 | } catch { } 66 | } else { 67 | do { 68 | let url = URL(fileURLWithPath: path) 69 | try (url as NSURL).setResourceValue(true, forKey: URLResourceKey.isExcludedFromBackupKey) 70 | return true 71 | } catch { } 72 | } 73 | } 74 | return false 75 | } 76 | 77 | public class func skipBackup() { 78 | _ = skipBackup(docDir) 79 | _ = skipBackup(libraryDir) 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Sources/Extensions/NSLock.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSLock.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 12/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension NSLock { 12 | 13 | public func sync(_ block: () -> Void) { 14 | let locked = `try`() 15 | block() 16 | if locked { 17 | unlock() 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sources/Extensions/NSURL.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSURL.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public enum HTTPStatus: Int { 12 | // Informational 1xx 13 | case `continue` = 100 14 | case switchingProtocols = 101 15 | case processing = 102 16 | case checkpoint = 103 17 | 18 | // Successful 2xx 19 | case success = 200 20 | case created = 201 21 | case accepted = 202 22 | case nonAuthoritativeInformation = 203 23 | case noContent = 204 24 | case resetContent = 205 25 | case partialContent = 206 26 | case multiStatus = 207 27 | case alreadyReported = 208 28 | case imUsed = 226 29 | 30 | // Redirection 3xx 31 | case multipleChoices = 300 32 | case movedPermanently = 301 33 | case found = 302 34 | case seeOther = 303 35 | case notModified = 304 36 | case useProxy = 305 37 | case switchProxy = 306 38 | case temporaryRedirect = 307 39 | case resumeIncomplete = 308 40 | 41 | // Client Error 4xx 42 | case badRequest = 400 43 | case unauthorized = 401 44 | case paymentRequired = 402 45 | case forbidden = 403 46 | case notFound = 404 47 | case methodNotAllowed = 405 48 | case notAcceptable = 406 49 | case proxyAuthenticationRequired = 407 50 | case requestTimeout = 408 51 | case conflict = 409 52 | case gone = 410 53 | case lengthRequired = 411 54 | case preconditionFailed = 412 55 | case requestEntityTooLarge = 413 56 | case requestURITooLong = 414 57 | case unsupportedMediaType = 415 58 | case requestedRangeNotSatisfiable = 416 59 | case expectationFailed = 417 60 | case imATeapot = 418 61 | case authenticationTimeout = 419 62 | case enhanceYourCalm = 420 63 | case misdirectedRequest = 421 64 | case unprocessableEntity = 422 65 | case locked = 423 66 | case failedDependency = 424 67 | case upgradeRequired = 426 68 | case preconditionRequired = 428 69 | case tooManyRequests = 429 70 | case requestHeaderFieldsTooLarge = 431 71 | case loginTimeout = 440 72 | case noResponse = 444 73 | case retryWith = 449 74 | case blockedByWindowsParentalControls = 450 75 | case wrongExchangeServer = 451 76 | case requestHeaderTooLarge = 494 77 | case certError = 495 78 | case noCert = 496 79 | case httPtoHTTPS = 497 80 | case tokenExpiredOrInvalid = 498 81 | case cientClosedRequest = 499 82 | 83 | // Server Error 5xx 84 | case internalServerError = 500 85 | case notImplemented = 501 86 | case badGateway = 502 87 | case serviceUnavailable = 503 88 | case gatewayTimeout = 504 89 | case httpVersionNotSupported = 505 90 | case variantAlsoNegotiates = 506 91 | case insufficientStorage = 507 92 | case loopDetected = 508 93 | case bandwidthLimitExceeded = 509 94 | case notExtended = 510 95 | case networkAuthenticationRequired = 511 96 | case networkReadTimeout = 598 97 | case networkConnectTimeout = 599 98 | 99 | public init?(code: Int) { 100 | self.init(rawValue: code) 101 | } 102 | 103 | public var code: Int { 104 | return rawValue 105 | } 106 | } 107 | 108 | extension HTTPStatus: CustomStringConvertible { 109 | 110 | public var description: String { 111 | switch self { 112 | case .continue: // 100 113 | return "The server has received the request headers, and the client should proceed to send the request body." 114 | case .switchingProtocols: // 101 115 | return "The requester has asked the server to switch protocols." 116 | case .processing: 117 | return "Server has received and is processing the request." 118 | case .checkpoint: // 103 119 | return "Used in the resumable requests proposal to resume aborted PUT or POST requests." 120 | case .success: // 200 121 | return "The request is OK." 122 | case .created: // 201 123 | return "The request has been fulfilled, and a new resource is created ." 124 | case .accepted: // 202 125 | return "The request has been accepted for processing, but the processing has not been completed." 126 | case .nonAuthoritativeInformation: // 203 127 | return "The request has been successfully processed, but is returning information that may be from another source." 128 | case .noContent: // 204 129 | return "The request has been successfully processed, but is not returning any content." 130 | case .resetContent: // 205 131 | return "The request has been successfully processed, but is not returning any content, and requires that the requester reset the document view." 132 | case .partialContent: // 206 133 | return "The server is delivering only part of the resource due to a range header sent by the client." 134 | case .multiStatus: // 207 135 | return "XML, can contain multiple separate responses." 136 | case .alreadyReported: // 208 137 | return "Results previously returned." 138 | case .imUsed: // 226 139 | return "Request fulfilled, reponse is instance-manipulations." 140 | case .multipleChoices: // 300 141 | return "A link list. The user can select a link and go to that location. Maximum five addresses." 142 | case .movedPermanently: // 301 143 | return "The requested page has moved to a new URL." 144 | case .found: // 302 145 | return "The requested page has moved temporarily to a new URL." 146 | case .seeOther: // 303 147 | return "The requested page can be found under a different URL." 148 | case .notModified: // 304 149 | return "Indicates the requested page has not been modified since last requested." 150 | case .useProxy: // 305 151 | return "The requested resource must be accessed through the proxy given by the Location field." 152 | case .switchProxy: // 306 153 | return "No longer used." 154 | case .temporaryRedirect: // 307 155 | return "The requested page has moved temporarily to a new URL" 156 | case .resumeIncomplete: // 308 157 | return "Used in the resumable requests proposal to resume aborted PUT or POST requests." 158 | case .badRequest: // 400 159 | return "The request cannot be fulfilled due to bad syntax." 160 | case .unauthorized: // 401 161 | return "The request was a legal request, but the server is refusing to respond to it. For use when authentication is possible but has failed or not yet been provided." 162 | case .paymentRequired: // 402 163 | return "Reserved for future use." 164 | case .forbidden: // 403 165 | return "The request was a legal request, but the server is refusing to respond to it." 166 | case .notFound: // 404 167 | return "The requested page could not be found but may be available again in the future." 168 | case .methodNotAllowed: // 405 169 | return "A request was made of a page using a request method not supported by that page." 170 | case .notAcceptable: // 406 171 | return "The server can only generate a response that is not accepted by the client." 172 | case .proxyAuthenticationRequired: // 407 173 | return "The client must first authenticate itself with the proxy." 174 | case .requestTimeout: // 408 175 | return "The server timed out waiting for the request." 176 | case .conflict: // 409 177 | return "The request could not be completed because of a conflict in the request." 178 | case .gone: // 410 179 | return "The requested page is no longer available." 180 | case .lengthRequired: // 411 181 | return "The \"Content-Length\" is not defined. The server will not accept the request without it." 182 | case .preconditionFailed: // 412 183 | return "The precondition given in the request evaluated to false by the server." 184 | case .requestEntityTooLarge: // 413 185 | return "The server will not accept the request, because the request entity is too large." 186 | case .requestURITooLong: // 414 187 | return "The server will not accept the request, because the URL is too long. Occurs when you convert a POST request to a GET request with a long query information." 188 | case .unsupportedMediaType: // 415 189 | return "The server will not accept the request, because the media type is not supported." 190 | case .requestedRangeNotSatisfiable: // 416 191 | return "The client has asked for a portion of the file, but the server cannot supply that portion." 192 | case .expectationFailed: // 417 193 | return "The server cannot meet the requirements of the Expect request-header field." 194 | case .imATeapot: // 418 195 | return "I'm a teapot" 196 | case .authenticationTimeout: // 419 197 | return "Previously valid authentication has expired." 198 | case .enhanceYourCalm: // 420 199 | return "Twitter rate limiting." 200 | case .misdirectedRequest: // 421 201 | return "The request was directed at a server that is not able to produce a response." 202 | case .unprocessableEntity: // 422 203 | return "Request unable to be followed due to semantic errors." 204 | case .locked: // 423 205 | return "The resource that is being accessed is locked." 206 | case .failedDependency: // 424 207 | return "The request failed due to failure of a previous request." 208 | case .upgradeRequired: // 426 209 | return "The client should switch to a different protocol." 210 | case .preconditionRequired: // 428 211 | return "The origin server requires the request to be conditional." 212 | case .tooManyRequests: // 429 213 | return "The user has sent too many requests in a given amount of time." 214 | case .requestHeaderFieldsTooLarge: // 431 215 | return "Server is unwilling to process the request." 216 | case .loginTimeout: // 440 217 | return "Your session has expired." 218 | case .noResponse: // 444 219 | return "Server returns no information and closes the connection." 220 | case .retryWith: // 449 221 | return "Request should be retried after performing action." 222 | case .blockedByWindowsParentalControls: // 450 223 | return "Windows Parental Controls blocking access to webpage." 224 | case .wrongExchangeServer: // 451 225 | return "Resource access is denied for legal reasons." 226 | case .requestHeaderTooLarge: // 494 227 | return "Server is unwilling to process the request." 228 | case .certError: // 495 229 | return "SSL client certificate error occurred to distinguish it from 4XX in a log and an error page redirection." 230 | case .noCert: // 496 231 | return "Client didn't provide certificate to distinguish it from 4XX in a log and an error page redirection." 232 | case .httPtoHTTPS: // 497 233 | return "The plain HTTP requests are sent to HTTPS port to distinguish it from 4XX in a log and an error page redirection." 234 | case .tokenExpiredOrInvalid: // 498 235 | return "An expired or otherwise invalid token." 236 | case .cientClosedRequest: // 499 237 | return "Connection closed by client while HTTP server is processing." 238 | case .internalServerError: // 500 239 | return "A generic error message, given when no more specific message is suitable." 240 | case .notImplemented: // 501 241 | return "The server either does not recognize the request method, or it lacks the ability to fulfill the request." 242 | case .badGateway: // 502 243 | return "The server was acting as a gateway or proxy and received an invalid response from the upstream server." 244 | case .serviceUnavailable: // 503 245 | return "The server is currently unavailable (overloaded or down)." 246 | case .gatewayTimeout: // 504 247 | return "The server was acting as a gateway or proxy and did not receive a timely response from the upstream server." 248 | case .httpVersionNotSupported: // 505 249 | return "The server does not support the HTTP protocol version used in the request." 250 | case .variantAlsoNegotiates: // 506 251 | return "Transparent content negotiation for the request results in a circular reference." 252 | case .insufficientStorage: // 507 253 | return "The server is unable to store the representation needed to complete the request." 254 | case .loopDetected: // 508 255 | return "The server detected an infinite loop while processing the request." 256 | case .bandwidthLimitExceeded: // 509 257 | return "Server reached the bandwidth limit that the system administrator imposed." 258 | case .notExtended: // 510 259 | return "Further extensions to the request are required for the server to fulfil it." 260 | case .networkAuthenticationRequired: // 511 261 | return "The client needs to authenticate to gain network access." 262 | case .networkReadTimeout: // 598 263 | return "Network read timeout behind the proxy." 264 | case .networkConnectTimeout: // 599 265 | return "Network connect timeout behind the proxy." 266 | } 267 | } 268 | } 269 | 270 | extension NSError { 271 | 272 | public convenience init(domain: String? = nil, status: HTTPStatus, message: String? = nil) { 273 | let domain = domain ?? Bundle.main.bundleIdentifier ?? "" 274 | let userInfo: [String: String] = [NSLocalizedDescriptionKey: message ?? status.description] 275 | self.init(domain: domain, code: status.code, userInfo: userInfo) 276 | } 277 | 278 | public convenience init(domain: String? = nil, code: Int = -999, message: String) { 279 | let domain = domain ?? Bundle.main.bundleIdentifier ?? "" 280 | let userInfo: [String: String] = [NSLocalizedDescriptionKey: message] 281 | self.init(domain: domain, code: code, userInfo: userInfo) 282 | } 283 | } 284 | 285 | extension URL { 286 | 287 | public var imageRequest: NSMutableURLRequest { 288 | let request = NSMutableURLRequest(url: self) 289 | request.addValue("image/*", forHTTPHeaderField: "Accept") 290 | return request 291 | } 292 | } 293 | -------------------------------------------------------------------------------- /Sources/Extensions/Range.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Range.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/9/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension Range { 12 | 13 | public static func random(from min: Int, to max: Int) -> ClosedRange { 14 | let lowerBound = Int.random(min: min, max: max) 15 | let upperBound = Int.random(min: lowerBound, max: max) 16 | return lowerBound...upperBound 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Sources/Extensions/Regex.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Regex.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/9/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension NSRegularExpression { 12 | 13 | public class func regex(_ pattern: String, ignoreCase: Bool = false) -> NSRegularExpression? { 14 | let options: NSRegularExpression.Options = ignoreCase ? [.caseInsensitive]: [] 15 | let regex: NSRegularExpression? 16 | do { 17 | regex = try NSRegularExpression(pattern: pattern, options: options) 18 | } catch { 19 | regex = nil 20 | } 21 | return regex 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sources/Extensions/String.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension String { 12 | 13 | public subscript(idx: Int) -> String? { 14 | guard idx >= 0 && idx < count else { return nil } 15 | return String(self[index(startIndex, offsetBy: idx)]) 16 | } 17 | 18 | public subscript(idx: Int) -> Character? { 19 | guard idx >= 0 && idx < count else { return nil } 20 | return self[index(startIndex, offsetBy: idx)] 21 | } 22 | 23 | public subscript(range: Range) -> String? { 24 | let lowerIndex = index(startIndex, offsetBy: max(0, range.lowerBound), limitedBy: endIndex) ?? endIndex 25 | let higherIndex = index(lowerIndex, offsetBy: range.upperBound - range.lowerBound, limitedBy: endIndex) ?? endIndex 26 | return String(self[lowerIndex..) -> String { 30 | let lowerIndex = index(startIndex, offsetBy: max(0, range.lowerBound), limitedBy: endIndex) ?? endIndex 31 | let higherIndex = index(lowerIndex, offsetBy: range.upperBound - range.lowerBound + 1, limitedBy: endIndex) ?? endIndex 32 | return String(self[lowerIndex.. [NSTextCheckingResult]? { 42 | if let regex = NSRegularExpression.regex(pattern, ignoreCase: ignoreCase) { 43 | let range = NSRange(location: 0, length: length) 44 | return regex.matches(in: self, options: [], range: range).map { $0 } 45 | } 46 | return nil 47 | } 48 | 49 | public func contains(_ pattern: String, ignoreCase: Bool) -> Bool { 50 | guard let regex = NSRegularExpression.regex(pattern, ignoreCase: ignoreCase) else { 51 | return false 52 | } 53 | let range = NSRange(location: 0, length: count) 54 | return regex.firstMatch(in: self, options: [], range: range) != nil 55 | } 56 | 57 | public func replace(_ pattern: String, withString replacementString: String, ignoreCase: Bool = false) -> String? { 58 | if let regex = NSRegularExpression.regex(pattern, ignoreCase: ignoreCase) { 59 | let range = NSRange(location: 0, length: count) 60 | return regex.stringByReplacingMatches(in: self, options: [], range: range, withTemplate: replacementString) 61 | } 62 | return nil 63 | } 64 | 65 | public func insert(_ index: Int, _ string: String) -> String { 66 | if index > length { 67 | return self + string 68 | } else if index < 0 { 69 | return string + self 70 | } 71 | return self[0 ..< index]! + string + self[index ..< length]! 72 | } 73 | 74 | public func trimmedLeft(characterSet set: CharacterSet = CharacterSet.whitespacesAndNewlines) -> String { 75 | if let range = rangeOfCharacter(from: set.inverted) { 76 | return String(self[range.lowerBound ..< endIndex]) 77 | } 78 | return "" 79 | } 80 | 81 | public func trimmedRight(characterSet set: CharacterSet = CharacterSet.whitespacesAndNewlines) -> String { 82 | if let range = rangeOfCharacter(from: set.inverted, options: NSString.CompareOptions.backwards) { 83 | return String(self[startIndex ..< range.upperBound]) 84 | } 85 | return "" 86 | } 87 | 88 | public func trimmed(characterSet set: CharacterSet = CharacterSet.whitespacesAndNewlines) -> String { 89 | return trimmedLeft(characterSet: set).trimmedRight(characterSet: set) 90 | } 91 | 92 | public func trimmedLeftCJK() -> String { 93 | var text = self 94 | while text.first == Character("\n") || text.first == Character(" ") { 95 | text.removeFirst(1) 96 | } 97 | return text 98 | } 99 | 100 | public func trimmedRightCJK() -> String { 101 | var text = self 102 | while text.last == Character("\n") || text.last == Character(" ") { 103 | text.removeLast(1) 104 | } 105 | return text 106 | } 107 | 108 | public func trimmedCJK() -> String { 109 | return trimmedLeftCJK().trimmedRightCJK() 110 | } 111 | 112 | public static func random(length len: Int = 0, charset: String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") -> String { 113 | let len = len < 1 ? len : Int.random(max: 16) 114 | var result = String() 115 | let max = charset.length - 1 116 | for _ in 0 ..< len { 117 | result += String(charset[Int.random(min: 0, max: max)]!) 118 | } 119 | return result 120 | } 121 | 122 | public var intValue: Int { 123 | return Int(self) ?? 0 124 | } 125 | 126 | public var doubleValue: Double { 127 | return Double(self) ?? 0.0 128 | } 129 | 130 | public var floatValue: Float { 131 | return Float(self) ?? 0.0 132 | } 133 | 134 | public var boolValue: Bool { 135 | return (self as NSString).boolValue 136 | } 137 | 138 | public func replaceKeysByValues(_ values: [String: AnyObject]) -> String { 139 | let str: NSMutableString = NSMutableString(string: self) 140 | let range = NSRange(location: 0, length: str.length) 141 | for (key, value) in values { 142 | str.replaceOccurrences(of: key, with: "\(value)", options: [.caseInsensitive, .literal], range: range) 143 | } 144 | return str as NSString as String 145 | } 146 | 147 | public func appending(path: String) -> String { 148 | let set = CharacterSet(charactersIn: "/") 149 | let left = trimmedRight(characterSet: set) 150 | let right = path.trimmed(characterSet: set) 151 | return left + "/" + right 152 | } 153 | 154 | /// The file-system path components of the receiver. (read-only) 155 | public var pathComponents: [String] { 156 | return (self as NSString).pathComponents 157 | } 158 | 159 | /// The last path component of the receiver. (read-only) 160 | public var lastPathComponent: String { 161 | return (self as NSString).lastPathComponent 162 | } 163 | 164 | /// The path extension, if any, of the string as interpreted as a path. (read-only) 165 | public var pathExtension: String { 166 | return (self as NSString).pathExtension 167 | } 168 | 169 | /// Initializes an NSURL object with a provided URL string. (read-only) 170 | public var url: URL? { 171 | return URL(string: self) 172 | } 173 | 174 | /// The host, conforming to RFC 1808. (read-only) 175 | public var host: String { 176 | if let url = url, let host = url.host { 177 | return host 178 | } 179 | return "" 180 | } 181 | 182 | // Returns a localized string, using the main bundle. 183 | 184 | public func localized(_ comment: String = "") -> String { 185 | return NSLocalizedString(self, comment: comment) 186 | } 187 | 188 | /// Returns data with NSUTF8StringEncoding 189 | 190 | public func toData() -> Data! { 191 | return data(using: String.Encoding.utf8) 192 | } 193 | 194 | // MARK: Validation 195 | public struct Regex { 196 | public static let Number = "^(?:|0|[1-9]\\d*)(?:\\.\\d*)?$" 197 | public static let Name = "[a-zA-Z\\s]+" 198 | public static let Email1 = ".+@([A-Za-z0-9]+\\.)+[A-Za-z]{2}[A-Za-z]*" 199 | public static let Email2 = "[A-Z0-9a-z\\._%+-]+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,4}" 200 | public static let Password = "[a-zA-Z0-9_]+" 201 | public static let URL = "(http|https)://((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+" 202 | } 203 | 204 | public func validate(_ regex: String) -> Bool { 205 | let pre = NSPredicate(format: "SELF MATCHES %@", regex) 206 | return pre.evaluate(with: self) 207 | } 208 | } 209 | 210 | extension Character { 211 | 212 | public var intValue: Int { 213 | return (String(self) as NSString).integerValue 214 | } 215 | } 216 | 217 | extension NSMutableAttributedString { 218 | 219 | public func append(string: String, attributes: [NSAttributedString.Key: Any]) { 220 | let str = NSMutableAttributedString(string: string, attributes: attributes) 221 | append(str) 222 | } 223 | } 224 | 225 | extension NSMutableParagraphStyle { 226 | 227 | public class func defaultStyle() -> NSMutableParagraphStyle! { 228 | let style = NSMutableParagraphStyle() 229 | let defaultStyle = NSParagraphStyle.default 230 | style.lineSpacing = defaultStyle.lineSpacing 231 | style.paragraphSpacing = defaultStyle.paragraphSpacing 232 | style.alignment = defaultStyle.alignment 233 | style.firstLineHeadIndent = defaultStyle.firstLineHeadIndent 234 | style.headIndent = defaultStyle.headIndent 235 | style.tailIndent = defaultStyle.tailIndent 236 | style.lineBreakMode = defaultStyle.lineBreakMode 237 | style.minimumLineHeight = defaultStyle.minimumLineHeight 238 | style.maximumLineHeight = defaultStyle.maximumLineHeight 239 | style.baseWritingDirection = defaultStyle.baseWritingDirection 240 | style.lineHeightMultiple = defaultStyle.lineHeightMultiple 241 | style.paragraphSpacingBefore = defaultStyle.paragraphSpacingBefore 242 | style.hyphenationFactor = defaultStyle.hyphenationFactor 243 | style.tabStops = defaultStyle.tabStops 244 | style.defaultTabInterval = defaultStyle.defaultTabInterval 245 | return style 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /Sources/Extensions/UICollectionView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UICollectionView.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/22/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UICollectionView { 12 | 13 | public func register(_ aClass: T.Type) { 14 | let name = String(describing: aClass) 15 | let bundle = Bundle.main 16 | if bundle.path(forResource: name, ofType: "nib") != nil { 17 | let nib = UINib(nibName: name, bundle: bundle) 18 | register(nib, forCellWithReuseIdentifier: name) 19 | } else { 20 | register(aClass, forCellWithReuseIdentifier: name) 21 | } 22 | } 23 | 24 | public func register(header aClass: T.Type) { 25 | let name = String(describing: aClass) 26 | let kind = UICollectionView.elementKindSectionHeader 27 | let bundle = Bundle.main 28 | if bundle.path(forResource: name, ofType: "nib") != nil { 29 | let nib = UINib(nibName: name, bundle: bundle) 30 | register(nib, forSupplementaryViewOfKind: kind, withReuseIdentifier: name) 31 | } else { 32 | register(aClass, forSupplementaryViewOfKind: kind, withReuseIdentifier: name) 33 | } 34 | } 35 | 36 | public func register(footer aClass: T.Type) { 37 | let name = String(describing: aClass) 38 | let kind = UICollectionView.elementKindSectionFooter 39 | let bundle = Bundle.main 40 | if bundle.path(forResource: name, ofType: "nib") != nil { 41 | let nib = UINib(nibName: name, bundle: bundle) 42 | register(nib, forSupplementaryViewOfKind: kind, withReuseIdentifier: name) 43 | } else { 44 | register(aClass, forSupplementaryViewOfKind: kind, withReuseIdentifier: name) 45 | } 46 | } 47 | 48 | public func dequeue(_ aClass: T.Type, forIndexPath indexPath: IndexPath) -> T { 49 | let name = String(describing: aClass) 50 | guard let cell = dequeueReusableCell(withReuseIdentifier: name, for: indexPath) as? T else { 51 | fatalError("\(name) is not registed") 52 | } 53 | return cell 54 | } 55 | 56 | public func dequeue(header aClass: T.Type, forIndexPath indexPath: IndexPath) -> T { 57 | let name = String(describing: aClass) 58 | guard let cell = dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: name, for: indexPath) as? T else { 59 | fatalError("\(name) is not registed") 60 | } 61 | return cell 62 | } 63 | 64 | public func dequeue(footer aClass: T.Type, forIndexPath indexPath: IndexPath) -> T { 65 | let name = String(describing: aClass) 66 | guard let cell = dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: name, for: indexPath) as? T else { 67 | fatalError("\(name) is not registed") 68 | } 69 | return cell 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Sources/Extensions/UIColor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIColor { 12 | 13 | public class func RGB(_ red: Int, _ green: Int, _ blue: Int, _ alpha: CGFloat = 1) -> UIColor { 14 | let red = max(0.0, min(CGFloat(red) / 255.0, 1.0)) 15 | let green = max(0.0, min(CGFloat(green) / 255.0, 1.0)) 16 | let blue = max(0.0, min(CGFloat(blue) / 255.0, 1.0)) 17 | let alpha = max(0.0, min(alpha, 1.0)) 18 | return UIColor(red: red, green: green, blue: blue, alpha: alpha) 19 | } 20 | 21 | public func image(_ size: CGSize = CGSize(width: 1, height: 1)) -> UIImage { 22 | UIGraphicsBeginImageContextWithOptions(size, false, UIScreen.main.scale) 23 | let ctx = UIGraphicsGetCurrentContext() 24 | setFill() 25 | ctx?.fillPath() 26 | let img = UIGraphicsGetImageFromCurrentImageContext() 27 | UIGraphicsEndImageContext() 28 | return img! 29 | } 30 | } 31 | 32 | public func == (lhs: UIColor, rhs: UIColor) -> Bool { 33 | return lhs.isEqual(rhs) 34 | } 35 | -------------------------------------------------------------------------------- /Sources/Extensions/UIGeometry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIEdgeInsets.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIEdgeInsets { 12 | 13 | public init(inset: CGFloat) { 14 | self.init(top: inset, left: inset, bottom: inset, right: inset) 15 | } 16 | 17 | public var inverse: UIEdgeInsets { 18 | return UIEdgeInsets(top: -top, left: -left, bottom: -bottom, right: -right) 19 | } 20 | 21 | public func inset(_ rect: CGRect) -> CGRect { 22 | return rect.inset(by: self) 23 | } 24 | 25 | public var isZero: Bool { 26 | return top == 0 && left == 0 && bottom == 0 && right == 0 27 | } 28 | } 29 | 30 | public func + (lhs: UIEdgeInsets, rhs: CGFloat) -> UIEdgeInsets { 31 | var insets = lhs 32 | insets.top += rhs 33 | insets.left += rhs 34 | insets.bottom += rhs 35 | insets.right += rhs 36 | return insets 37 | } 38 | 39 | public func - (lhs: UIEdgeInsets, rhs: CGFloat) -> UIEdgeInsets { 40 | var insets = lhs 41 | insets.top -= rhs 42 | insets.left -= rhs 43 | insets.bottom -= rhs 44 | insets.right -= rhs 45 | return insets 46 | } 47 | 48 | public func * (lhs: UIEdgeInsets, rhs: CGFloat) -> UIEdgeInsets { 49 | var insets = lhs 50 | insets.top *= rhs 51 | insets.left *= rhs 52 | insets.bottom *= rhs 53 | insets.right *= rhs 54 | return insets 55 | } 56 | 57 | public func / (lhs: UIEdgeInsets, rhs: CGFloat) -> UIEdgeInsets { 58 | var insets = lhs 59 | insets.top /= rhs 60 | insets.left /= rhs 61 | insets.bottom /= rhs 62 | insets.right /= rhs 63 | return insets 64 | } 65 | 66 | public func += (lhs: inout UIEdgeInsets, rhs: CGFloat) -> UIEdgeInsets { 67 | lhs.top += rhs 68 | lhs.left += rhs 69 | lhs.bottom += rhs 70 | lhs.right += rhs 71 | return lhs 72 | } 73 | 74 | public func -= (lhs: inout UIEdgeInsets, rhs: CGFloat) -> UIEdgeInsets { 75 | lhs.top -= rhs 76 | lhs.left -= rhs 77 | lhs.bottom -= rhs 78 | lhs.right -= rhs 79 | return lhs 80 | } 81 | 82 | public func *= (lhs: inout UIEdgeInsets, rhs: CGFloat) -> UIEdgeInsets { 83 | lhs.top *= rhs 84 | lhs.left *= rhs 85 | lhs.bottom *= rhs 86 | lhs.right *= rhs 87 | return lhs 88 | } 89 | 90 | public func /= (lhs: inout UIEdgeInsets, rhs: CGFloat) -> UIEdgeInsets { 91 | lhs.top /= rhs 92 | lhs.left /= rhs 93 | lhs.bottom /= rhs 94 | lhs.right /= rhs 95 | return lhs 96 | } 97 | -------------------------------------------------------------------------------- /Sources/Extensions/UIImage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/23/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIImage { 12 | 13 | public func scaleToSize(_ newSize: CGSize, aspectFill: Bool = false) -> UIImage { 14 | let scaleFactorWidth = newSize.width / size.width 15 | let scaleFactorHeight = newSize.height / size.height 16 | let scaleFactor = aspectFill ? max(scaleFactorWidth, scaleFactorHeight) : min(scaleFactorWidth, scaleFactorHeight) 17 | 18 | var scaledSize = size 19 | scaledSize.width *= scaleFactor 20 | scaledSize.height *= scaleFactor 21 | 22 | UIGraphicsBeginImageContextWithOptions(scaledSize, false, UIScreen.main.scale) 23 | let scaledImageRect = CGRect(x: 0.0, y: 0.0, width: scaledSize.width, height: scaledSize.height) 24 | draw(in: scaledImageRect) 25 | let scaledImage = UIGraphicsGetImageFromCurrentImageContext() 26 | UIGraphicsEndImageContext() 27 | 28 | return scaledImage! 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sources/Extensions/UILayoutPriority.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UILayoutPriority.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UILayoutPriority { 12 | 13 | public static var Required: Float { return 1000.0 } 14 | public static var DefaultHigh: Float { return 750.0 } 15 | public static var FittingSizeLevel: Float { return 500.0 } 16 | public static var DefaultLow: Float { return 250.0 } 17 | } 18 | -------------------------------------------------------------------------------- /Sources/Extensions/UITableView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UITableView.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UITableView { 12 | 13 | override open var delaysContentTouches: Bool { 14 | didSet { 15 | for view in subviews { 16 | if let scroll = view as? UIScrollView { 17 | scroll.delaysContentTouches = delaysContentTouches 18 | } 19 | break 20 | } 21 | } 22 | } 23 | 24 | public func setSeparatorInsets(_ insets: UIEdgeInsets) { 25 | separatorInset = insets 26 | layoutMargins = insets 27 | } 28 | 29 | public func scrollsToBottom(_ animated: Bool) { 30 | let section = numberOfSections - 1 31 | let row = numberOfRows(inSection: section) - 1 32 | if section < 0 || row < 0 { 33 | return 34 | } 35 | let path = IndexPath(row: row, section: section) 36 | let offset = contentOffset.y 37 | scrollToRow(at: path, at: .top, animated: animated) 38 | let delay = (animated ? 0.2 : 0.0) * Double(NSEC_PER_SEC) 39 | let time = DispatchTime.now() + Double(Int64(delay)) / Double(NSEC_PER_SEC) 40 | DispatchQueue.main.asyncAfter(deadline: time, execute: { 41 | if self.contentOffset.y != offset { 42 | self.scrollsToBottom(false) 43 | } 44 | }) 45 | } 46 | 47 | public func register(_ aClass: T.Type) { 48 | let name = String(describing: aClass) 49 | let bundle = Bundle.main 50 | if bundle.path(forResource: name, ofType: "nib") != nil { 51 | let nib = UINib(nibName: name, bundle: bundle) 52 | register(nib, forCellReuseIdentifier: name) 53 | } else { 54 | register(aClass, forCellReuseIdentifier: name) 55 | } 56 | } 57 | 58 | public func register(_ aClass: T.Type) { 59 | let name = String(describing: aClass) 60 | let bundle = Bundle.main 61 | if bundle.path(forResource: name, ofType: "nib") != nil { 62 | let nib = UINib(nibName: name, bundle: bundle) 63 | register(nib, forHeaderFooterViewReuseIdentifier: name) 64 | } else { 65 | register(aClass, forHeaderFooterViewReuseIdentifier: name) 66 | } 67 | } 68 | 69 | public func dequeue(_ aClass: T.Type) -> T { 70 | let name = String(describing: aClass) 71 | guard let cell = dequeueReusableCell(withIdentifier: name) as? T else { 72 | fatalError("`\(name)` is not registed") 73 | } 74 | return cell 75 | } 76 | 77 | public func dequeue(_ aClass: T.Type) -> T { 78 | let name = String(describing: aClass) 79 | guard let cell = dequeueReusableHeaderFooterView(withIdentifier: name) as? T else { 80 | fatalError("`\(name)` is not registed") 81 | } 82 | return cell 83 | } 84 | } 85 | 86 | extension UITableViewCell { 87 | 88 | public func setSeparatorInsets(_ insets: UIEdgeInsets) { 89 | separatorInset = insets 90 | layoutMargins = insets 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Sources/Extensions/UIView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class IntrinsicContentView: UIView { 12 | open var intrinsicContentSizeEnabled = true 13 | } 14 | 15 | extension UIView { 16 | 17 | public class func nib() -> UINib { 18 | return UINib(nibName: String(describing: self), bundle: nil) 19 | } 20 | 21 | public class func loadNib() -> T { 22 | let name = String(describing: self) 23 | let bundle = Bundle(for: T.self) 24 | guard let xib = bundle.loadNibNamed(name, owner: nil, options: nil)?.first as? T else { 25 | fatalError("Cannot load nib named `\(name)`") 26 | } 27 | return xib 28 | } 29 | } 30 | 31 | // MARK: Appearance 32 | extension UIView { 33 | 34 | public func clearSubViews() { 35 | backgroundColor = UIColor.clear 36 | for sub in subviews { 37 | sub.clearSubViews() 38 | } 39 | } 40 | 41 | public func border(color: UIColor, width: CGFloat) { 42 | layer.borderColor = color.cgColor 43 | layer.borderWidth = width 44 | layer.cornerRadius = corner 45 | layer.masksToBounds = true 46 | } 47 | 48 | public var corner: CGFloat { 49 | get { 50 | return layer.cornerRadius 51 | } 52 | set { 53 | layer.cornerRadius = newValue 54 | layer.masksToBounds = true 55 | } 56 | } 57 | 58 | public func circle() { 59 | layer.cornerRadius = min(bounds.width, bounds.height) / 2 60 | layer.masksToBounds = true 61 | } 62 | 63 | public enum BorderPostition { 64 | case top 65 | case left 66 | case bottom 67 | case right 68 | } 69 | 70 | public func border(_ pos: BorderPostition, color: UIColor = UIColor.black, 71 | width: CGFloat = 0.5, insets: UIEdgeInsets = .zero) { 72 | let rect: CGRect = { 73 | switch pos { 74 | case .top: return CGRect(x: 0, y: 0, width: frame.width, height: width) 75 | case .left: return CGRect(x: 0, y: 0, width: width, height: frame.height) 76 | case .bottom: return CGRect(x: 0, y: frame.height - width, width: frame.width, height: width) 77 | case .right: return CGRect(x: frame.width - width, y: 0, width: width, height: frame.height) 78 | } 79 | }() 80 | let border = UIView(frame: rect) 81 | border.backgroundColor = color 82 | border.autoresizingMask = { 83 | switch pos { 84 | case .top: return [.flexibleWidth, .flexibleBottomMargin] 85 | case .left: return [.flexibleHeight, .flexibleRightMargin] 86 | case .bottom: return [.flexibleWidth, .flexibleTopMargin] 87 | case .right: return [.flexibleHeight, .flexibleLeftMargin] 88 | } 89 | }() 90 | addSubview(border) 91 | } 92 | 93 | public func shadow(color: UIColor, offset: CGSize = CGSize(width: 0, height: 0), 94 | opacity: Float = 1.0, radius: CGFloat = 3.0) { 95 | layer.shadowColor = color.cgColor 96 | layer.shadowOffset = offset 97 | layer.shadowOpacity = opacity 98 | layer.shadowRadius = radius 99 | layer.shouldRasterize = true 100 | layer.rasterizationScale = UIScreen.main.scale 101 | } 102 | } 103 | 104 | // MARK: Layout 105 | extension UIView { 106 | 107 | public func removeSubviewsConstraints() { 108 | removeConstraints(constraints.filter({ (constraint: NSLayoutConstraint) -> Bool in 109 | let first = constraint.firstItem as? UIView 110 | let second = constraint.secondItem as? UIView 111 | if (first == self && second == self) || (first == self && second == nil) || (first == nil && second == self) { 112 | return false 113 | } 114 | return true 115 | })) 116 | for sub in subviews { 117 | sub.translatesAutoresizingMaskIntoConstraints = false 118 | sub.removeAllConstraints() 119 | } 120 | } 121 | 122 | public func removeAllConstraints() { 123 | if let view = self as? IntrinsicContentView { 124 | if view.intrinsicContentSizeEnabled { 125 | return 126 | } 127 | } 128 | var parent = superview 129 | while parent != nil { 130 | for constraint in parent!.constraints { 131 | let first = constraint.firstItem as? UIView 132 | let second = constraint.secondItem as? UIView 133 | if first == self || second == self { 134 | parent!.removeConstraint(constraint) 135 | } 136 | } 137 | parent = parent!.superview 138 | } 139 | removeConstraints(constraints) 140 | let subviews = self.subviews 141 | for sub in subviews { 142 | sub.removeAllConstraints() 143 | } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /Sources/Extensions/UIViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 10/7/15. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIViewController { 12 | 13 | @objc open class func vc() -> Self { 14 | return self.init(nibName: String(describing: self), bundle: nil) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Sources/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 | FMWK 17 | CFBundleShortVersionString 18 | 4.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Tests/Array.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ArrayTests.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 2/29/16. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import MLSwiftUtils 11 | 12 | class ArrayTests: XCTestCase { 13 | 14 | let origin: [Int] = Array(1...100000) 15 | 16 | func test_shuffled() { 17 | var shuffled: [Int]! 18 | measure { 19 | shuffled = origin.shuffled() 20 | } 21 | let test = { (lhs: Int, rhs: Int) -> Bool in 22 | return lhs < rhs 23 | } 24 | XCTAssertEqual(shuffled.sorted(by: test), origin.sorted(by: test), "sorted shuffled should equal to sorted origin") 25 | } 26 | 27 | func test_map() { 28 | let nilInts: [Int?] = [0, 1, nil, 3] 29 | let ints: [Int] = nilInts.compactMap { $0 } 30 | let exp: [Int] = [0, 1, 3] 31 | XCTAssertEqual(ints, exp) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Tests/Bool.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BoolTests.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 6/6/16. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import MLSwiftUtils 11 | 12 | class BoolTests: XCTestCase { 13 | 14 | func test_toggle() { 15 | var bool = true 16 | bool.toggle() 17 | XCTAssertFalse(bool) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Tests/Data/TestView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestView.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 9/4/16. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TestView: UIView { } 12 | -------------------------------------------------------------------------------- /Tests/Data/TestView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Tests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Tests/String.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StringTests.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 7/28/16. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import MLSwiftUtils 11 | 12 | class StringTests: XCTestCase { 13 | 14 | func test_initWithClass() { 15 | let clazz = String(describing: UIViewController.self) 16 | XCTAssertEqual(clazz, "UIViewController") 17 | } 18 | 19 | func test_subscriptCharacter() { 20 | let str = "hello world" 21 | let sub: Character! = str[0] 22 | XCTAssertNotNil(sub) 23 | XCTAssertEqual(sub, "h") 24 | } 25 | 26 | func test_subscriptString() { 27 | let str = "hello world" 28 | let sub: String! = str[0] 29 | XCTAssertNotNil(sub) 30 | XCTAssertEqual(sub, "h") 31 | } 32 | 33 | func test_subscriptStringWithRange() { 34 | let str = "hello world" 35 | var sub: String! 36 | sub = str[0...1] 37 | XCTAssertNotNil(sub) 38 | XCTAssertEqual(sub, "he") 39 | sub = str[0...10] 40 | XCTAssertNotNil(sub) 41 | XCTAssertEqual(sub, "hello world") 42 | } 43 | 44 | func test_appending_path() { 45 | let str = "http://google.com" 46 | var path: String 47 | path = str.appending(path: "api/v3") 48 | XCTAssertEqual(path, "http://google.com/api/v3") 49 | path = str.appending(path: "/api/v3") 50 | XCTAssertEqual(path, "http://google.com/api/v3") 51 | path = str.appending(path: "/api/v3/") 52 | XCTAssertEqual(path, "http://google.com/api/v3") 53 | } 54 | 55 | func test_validate() { 56 | var email: String 57 | email = "supports@example.com" 58 | XCTAssertTrue(email.validate(String.Regex.Email2)) 59 | email = "supports$@example.com" 60 | XCTAssertFalse(email.validate(String.Regex.Email2)) 61 | email = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.com.vn" 62 | measure { 63 | XCTAssertTrue(email.validate(String.Regex.Email2)) 64 | } 65 | } 66 | 67 | func test_trimmedLeftCJK() { 68 | let str = " \n hello \n world" 69 | let sub = str.trimmedLeftCJK() 70 | XCTAssertNotNil(sub) 71 | XCTAssertEqual(sub, "hello \n world") 72 | } 73 | 74 | func test_trimmedRightCJK() { 75 | let str = "hello \n world \n " 76 | let sub = str.trimmedRightCJK() 77 | XCTAssertNotNil(sub) 78 | XCTAssertEqual(sub, "hello \n world") 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Tests/UIView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView.swift 3 | // MLSwiftUtils 4 | // 5 | // Created by DaoNV on 9/4/16. 6 | // Copyright © 2016 Asian Tech Co., Ltd. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import MLSwiftUtils 11 | 12 | class UIViewTests: XCTestCase { 13 | 14 | func test_loadNib() { 15 | let xib: TestView = TestView.loadNib() 16 | XCTAssertNotNil(xib) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /fastlane/Fastfile: -------------------------------------------------------------------------------- 1 | default_platform :ios 2 | 3 | platform :ios do 4 | desc "Runs all the tests" 5 | lane :test do 6 | scan 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /fastlane/Scanfile: -------------------------------------------------------------------------------- 1 | scheme "PodTest" 2 | devices ["iPhone 6s"] 3 | clean true -------------------------------------------------------------------------------- /scripts/branch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Branch name: $TRAVIS_PULL_REQUEST_BRANCH" 4 | 5 | if [[ "$TRAVIS_PULL_REQUEST_BRANCH" == 'master' ]]; then 6 | exit 0 7 | fi 8 | 9 | for PREFIX in feature bugfix hotfix release; do 10 | if [[ "$TRAVIS_PULL_REQUEST_BRANCH" == $PREFIX/* ]]; then 11 | exit 0 12 | fi 13 | for CODE in app lib; do 14 | if [[ "$TRAVIS_PULL_REQUEST_BRANCH" == $CODE/$PREFIX/* ]]; then 15 | exit 0 16 | fi 17 | done 18 | done 19 | 20 | echo "Branch name does not pass convention." 21 | exit 1 22 | -------------------------------------------------------------------------------- /scripts/codecov: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | bash <(curl -s https://codecov.io/bash) 4 | -------------------------------------------------------------------------------- /scripts/install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # DEV ENV 4 | 5 | # update submodule if need 6 | if [[ "$CI" != 'true' ]]; then 7 | git submodule update --init --recursive 8 | mkdir -p .git/hooks 9 | yes | cp -rf scripts/git/hooks/* .git/hooks/ 10 | fi 11 | 12 | # homebrew 13 | if ! which brew > /dev/null; then 14 | sudo chown -R "$(whoami)":admin '/usr/local' 15 | /usr/bin/ruby -e "$(curl -fsSL 'https://raw.githubusercontent.com/Homebrew/install/master/install')" 16 | mkdir -p '/Library/Caches/Homebrew' 17 | sudo chown -R "$(whoami)":admin '/Library/Caches/Homebrew' 18 | fi 19 | 20 | brew update 21 | 22 | # rbenv if need 23 | if [[ "$CI" != 'true' ]]; then 24 | if ! which rbenv > /dev/null; then 25 | echo 'install rbenv' 26 | brew install rbenv 27 | eval "$(rbenv init -)" 28 | echo 'which rbenv > /dev/null && eval "$(rbenv init -)"' >> ~/.bashrc 29 | fi 30 | brew outdated ruby-build || brew upgrade ruby-build 31 | echo 'n' | rbenv install || true 32 | rbenv rehash 33 | fi 34 | 35 | gem install bundler 36 | 37 | # PROJECT DEPENDENCES 38 | 39 | bundle install --path=vendor/bundle --jobs 4 --retry 3 40 | 41 | brew tap Homebrew/bundle 42 | brew bundle 43 | 44 | if ! bundle exec pod install; then 45 | bundle exec pod install --repo-update 46 | fi 47 | -------------------------------------------------------------------------------- /scripts/lint: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./Pods/SwiftLint/swiftlint lint --reporter json > swiftlint-report.json || false 4 | 5 | echo "REPO_SLUG = $TRAVIS_REPO_SLUG" 6 | echo "PR_NUMBER = $TRAVIS_PULL_REQUEST" 7 | 8 | if [[ -z "$TRAVIS_PULL_REQUEST" ]]; then 9 | echo 'Not in a Pull Request, skip report.' 10 | else 11 | bundle exec linterbot "$TRAVIS_REPO_SLUG" "$TRAVIS_PULL_REQUEST" < swiftlint-report.json 12 | fi 13 | -------------------------------------------------------------------------------- /scripts/pod_test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$CI" != 'true' ]]; then 4 | echo 'Exporting build environment variables...' 5 | export SDK='iphonesimulator11.1' 6 | export WORKSPACE='SwiftUtils.xcworkspace' 7 | export DESTINATION='OS=11.1,name=iPhone 6' 8 | fi 9 | 10 | xcodebuild build \ 11 | -workspace "$WORKSPACE" \ 12 | -scheme "PodTest" \ 13 | -sdk "$SDK" \ 14 | -destination "$DESTINATION" \ 15 | -derivedDataPath build \ 16 | ONLY_ACTIVE_ARCH=YES \ 17 | -configuration Debug | bundle exec xcpretty; exit ${PIPESTATUS[0]} 18 | -------------------------------------------------------------------------------- /scripts/pr_number: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | USERNAME="$(echo ${REPO_SLUG%/*})" 4 | URL="https://api.github.com/repos/$REPO_SLUG/pulls?head=$USERNAME:$SRC_BRANCH" 5 | RESULT="$(curl -X GET -u $GITHUB_ACCESS_TOKEN:x-oauth-basic $URL | jq -r '.[0].url')" 6 | [[ "$RESULT" == 'null' ]] && PR_NUMBER='' || PR_NUMBER="${RESULT//\"}" 7 | PR_NUMBER="$(basename "$PR_NUMBER")" 8 | echo "$PR_NUMBER" 9 | -------------------------------------------------------------------------------- /scripts/setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | brew update 3 | gem install bundler 4 | bundle install --path=vendor/bundle --jobs 4 --retry 3 5 | brew tap Homebrew/bundle 6 | brew bundle 7 | 8 | setup_cocoapods() { 9 | echo 'Setup cocoapods...' 10 | bundle exec pod setup --silent > /dev/null 11 | bundle exec pod repo update --silent 12 | bundle exec pod install 13 | } 14 | 15 | bundle exec pod install || setup_cocoapods 16 | -------------------------------------------------------------------------------- /scripts/setup_rbenv: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | which rbenv > /dev/null && exit 0 4 | 5 | echo 'install rbenv' 6 | brew install rbenv 7 | eval "$(rbenv init -)" 8 | echo 'which rbenv > /dev/null && eval "$(rbenv init -)"' >> ~/.bashrc 9 | 10 | rbver="$(rbenv local)" 11 | [[ -z "$rbver" ]] && rbver=$(head -n 1 '.ruby-version') 12 | if [[ ! $(rbenv versions | grep "$rbver") ]]; then 13 | echo "install gem $rbver" 14 | rbenv install $rbver 15 | rbenv rehash 16 | fi 17 | 18 | rbenv global "$rbver" 19 | 20 | gem install bundler 21 | -------------------------------------------------------------------------------- /scripts/src_branch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$CIRCLECI" == 'true' ]]; then 4 | echo "$CIRCLE_BRANCH" 5 | exit 0 6 | fi 7 | 8 | if [[ "$TRAVIS_PULL_REQUEST" == 'false' ]]; then 9 | echo "$TRAVIS_BRANCH" 10 | else 11 | URL="https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST" 12 | RESULT="$(curl -X GET -u $GITHUB_ACCESS_TOKEN:x-oauth-basic $URL | jq -r '.head.ref')" 13 | [[ "$RESULT" == 'null' ]] && TRAVIS_BRANCH='' || TRAVIS_BRANCH="${RESULT//\"}" 14 | echo "$TRAVIS_BRANCH" 15 | fi 16 | -------------------------------------------------------------------------------- /scripts/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$CI" != 'true' ]]; then 4 | echo 'Exporting build environment variables...' 5 | export WORKSPACE='SwiftUtils.xcworkspace' 6 | export SDK='iphonesimulator11.1' 7 | export SCHEME='SwiftUtils' 8 | export DESTINATION='OS=11.1,name=iPhone 6' 9 | fi 10 | 11 | rm -rf './build' 12 | 13 | xcodebuild build test \ 14 | -workspace "$WORKSPACE" \ 15 | -scheme "$SCHEME" \ 16 | -sdk "$SDK" \ 17 | -destination "$DESTINATION" \ 18 | -derivedDataPath build \ 19 | ONLY_ACTIVE_ARCH=YES \ 20 | -configuration Debug | bundle exec xcpretty; exit ${PIPESTATUS[0]} 21 | -------------------------------------------------------------------------------- /scripts/validate_branch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Branch name: $SRC_BRANCH" 4 | 5 | [[ "$SRC_BRANCH" == master ]] && exit 0 6 | 7 | for PREFIX in feature bugfix hotfix release; do 8 | [[ "$SRC_BRANCH" == $PREFIX/* ]] && exit 0 9 | done 10 | 11 | echo "Branch name does not pass convention." 12 | exit 1 13 | --------------------------------------------------------------------------------