From c75a874544b7c788e9ee430291866f2be31058d7 Mon Sep 17 00:00:00 2001 From: SimonL Date: Fri, 19 Jul 2019 15:43:16 +0200 Subject: [PATCH] Add new extensions and modify readme --- .../Pods-TymateSwiftExtensions.xcscheme | 29 ++++++++++++------ .../xcschemes/xcschememanagement.plist | 6 ++++ README.md | 10 ++++-- TymateSwiftExtensions.podspec | 2 +- .../project.pbxproj | 4 +++ .../UserInterfaceState.xcuserstate | Bin 21372 -> 27375 bytes TymateSwiftExtensions/DateExtensions.swift | 22 +++++++++++++ TymateSwiftExtensions/StringExtensions.swift | 13 ++++++-- 8 files changed, 72 insertions(+), 14 deletions(-) create mode 100644 TymateSwiftExtensions/DateExtensions.swift diff --git a/Pods/Pods.xcodeproj/xcuserdata/simon.xcuserdatad/xcschemes/Pods-TymateSwiftExtensions.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/simon.xcuserdatad/xcschemes/Pods-TymateSwiftExtensions.xcscheme index 89f1c7e..8b210a8 100644 --- a/Pods/Pods.xcodeproj/xcuserdata/simon.xcuserdatad/xcschemes/Pods-TymateSwiftExtensions.xcscheme +++ b/Pods/Pods.xcodeproj/xcuserdata/simon.xcuserdatad/xcschemes/Pods-TymateSwiftExtensions.xcscheme @@ -7,15 +7,15 @@ buildImplicitDependencies = "YES"> + buildForArchiving = "YES" + buildForAnalyzing = "YES"> @@ -23,14 +23,17 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + + + + debugDocumentVersioning = "YES"> diff --git a/Pods/Pods.xcodeproj/xcuserdata/simon.xcuserdatad/xcschemes/xcschememanagement.plist b/Pods/Pods.xcodeproj/xcuserdata/simon.xcuserdatad/xcschemes/xcschememanagement.plist index 7756727..2e8df33 100644 --- a/Pods/Pods.xcodeproj/xcuserdata/simon.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Pods/Pods.xcodeproj/xcuserdata/simon.xcuserdatad/xcschemes/xcschememanagement.plist @@ -8,16 +8,22 @@ isShown + orderHint + 0 Pods-TymateSwiftExtensions.xcscheme isShown + orderHint + 1 Toast-Swift.xcscheme isShown + orderHint + 2 SuppressBuildableAutocreation diff --git a/README.md b/README.md index 71052fa..912d9be 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # TymateSwiftExtensions -Just add "https://github.com/tymate/tymate-swift-extensions.git" as source and the pod 'TymateSwiftExtensions' to your Podfile +[![Platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20tvOS%20%7C%20macOS%20%7C%20watchOS-lightgrey.svg)](https://github.com/tymate/tymate-swift-extensions) +[![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg)](https://swift.org) +[![Xcode](https://img.shields.io/badge/Xcode-10.2-blue.svg)](https://developer.apple.com/xcode) +[![MIT](https://img.shields.io/badge/License-MIT-red.svg)](https://opensource.org/licenses/MIT) + +This pod have some useful functions and extensions that are often use in swift projects +For example you can check if a string is a valid email easily or design an imageView in circle ## String Extensions @@ -62,7 +68,7 @@ To integrate Extensions into your Xcode project using CocoaPods, specify it in y ```ruby source 'https://github.com/tymate/tymate-swift-extensions.git' -platform :ios, '8.0' + use_frameworks! pod 'TymateSwiftExtensions' diff --git a/TymateSwiftExtensions.podspec b/TymateSwiftExtensions.podspec index 331dbd8..c66506e 100644 --- a/TymateSwiftExtensions.podspec +++ b/TymateSwiftExtensions.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = "TymateSwiftExtensions" - spec.version = "0.0.5" + spec.version = "0.0.6" spec.summary = "A CocoaPods library written in Swift" spec.description = <<-DESC diff --git a/TymateSwiftExtensions.xcodeproj/project.pbxproj b/TymateSwiftExtensions.xcodeproj/project.pbxproj index ace0589..7a6aa27 100644 --- a/TymateSwiftExtensions.xcodeproj/project.pbxproj +++ b/TymateSwiftExtensions.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 5B6AA39F467E0BF2D262468F /* Pods_TymateSwiftExtensions.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6685F60706721708C67C8CF6 /* Pods_TymateSwiftExtensions.framework */; }; F403403022D76E4500784A3C /* UIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F403402F22D76E4500784A3C /* UIViewController.swift */; }; + F437662222E1FB7C004D24BD /* DateExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F437662122E1FB7C004D24BD /* DateExtensions.swift */; }; F464DAE522D39F2C002413BD /* TymateSwiftExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = F464DAE322D39F2C002413BD /* TymateSwiftExtensions.h */; settings = {ATTRIBUTES = (Public, ); }; }; F464DB1322D730A5002413BD /* StringExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F464DB1222D730A5002413BD /* StringExtensions.swift */; }; F464DB3322D76917002413BD /* DateFormatterExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F464DB3222D76917002413BD /* DateFormatterExtensions.swift */; }; @@ -20,6 +21,7 @@ 6685F60706721708C67C8CF6 /* Pods_TymateSwiftExtensions.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TymateSwiftExtensions.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 78A9AA7B809D409F49089628 /* Pods-TymateSwiftExtensions.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TymateSwiftExtensions.release.xcconfig"; path = "Target Support Files/Pods-TymateSwiftExtensions/Pods-TymateSwiftExtensions.release.xcconfig"; sourceTree = ""; }; F403402F22D76E4500784A3C /* UIViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewController.swift; sourceTree = ""; }; + F437662122E1FB7C004D24BD /* DateExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateExtensions.swift; sourceTree = ""; }; F464DAE022D39F2C002413BD /* TymateSwiftExtensions.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TymateSwiftExtensions.framework; sourceTree = BUILT_PRODUCTS_DIR; }; F464DAE322D39F2C002413BD /* TymateSwiftExtensions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TymateSwiftExtensions.h; sourceTree = ""; }; F464DAE422D39F2C002413BD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -84,6 +86,7 @@ F464DB3222D76917002413BD /* DateFormatterExtensions.swift */, F464DB3422D769E3002413BD /* UIImageViewExtensions.swift */, F403402F22D76E4500784A3C /* UIViewController.swift */, + F437662122E1FB7C004D24BD /* DateExtensions.swift */, ); path = TymateSwiftExtensions; sourceTree = ""; @@ -194,6 +197,7 @@ buildActionMask = 2147483647; files = ( F464DB3322D76917002413BD /* DateFormatterExtensions.swift in Sources */, + F437662222E1FB7C004D24BD /* DateExtensions.swift in Sources */, F464DB3522D769E3002413BD /* UIImageViewExtensions.swift in Sources */, F403403022D76E4500784A3C /* UIViewController.swift in Sources */, F464DB1322D730A5002413BD /* StringExtensions.swift in Sources */, diff --git a/TymateSwiftExtensions.xcworkspace/xcuserdata/simon.xcuserdatad/UserInterfaceState.xcuserstate b/TymateSwiftExtensions.xcworkspace/xcuserdata/simon.xcuserdatad/UserInterfaceState.xcuserstate index ec0b9cebbd31d9091dcea871d915a216e6bbba85..f4682dedc19306a765a39a06e412aad954244490 100644 GIT binary patch delta 14291 zcmb`t2|!av_da}Q?wznkk`Q*XkRT{a!Y%|z$O4KYA|NhABSNYu0tMVEHFIn0+C`1x zz924jtF_j>YHQWHRBP)}Tf4Z`R%_MPTCLXlpPLZG*XrB%_k9Esa_>23o;h=7=A7rw zU#q~)(_n@l!_)B6?R(Xcv=Dqc)7aHEm3oUBN6nz-QVXbsR5P`lT1Bm;Hd33ZZPYI6 zBWfRYh&oK2q)t(%sWa5q)OG3?>IQX_x<&m;{YKrUeg{0@2Hb%M@C07K8}NY=goBPC z0z`sNpfiX9(I5uIfh3R$GC(HC0w&N6);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Kxdf0l@`kD2#^}O{*>jmpC z)=SpQ)+^R~*2gwv!#1%^YLnSwY;|o$o7>jN*4Wn6_PniyE!CE0>uBp7v~{!fuoc-B z+1|39ww<^AWc%56(RST-&-TFf*pBSPF0za5QoG(>$8NBj>`8W;-D!8*pSQQPce3}g z_p$f453&!j7uXB!MfOqlG4`?ch4#1X-`F2Gs6*_CcE}w%N4z7!VR0lmYz~LR+n0$9l_3yu8u*DA&!xbagH*_BuCIO)iKL4*D>F*(6QLD#Ieiqwd1kV;Iuj& zPPfzRZ0v09Z0l_AOm(I?J39L~2Ra8kvz__QVb0;sLgz&1bms!+BIgq4a_0)?TIUAm zCg&FCcIO+;$AzboC<(>1^~$dwgzWxH}+0auA@ysOML$tAd6biLx5 z?poqn?po*C=-T4i?%L_v?fTGl&UMLk&-Kvtmm9l9Zi!pwR=Cw}vpdOcb35E_x6fVQ z-N@b8-PGOA-PJwRJ;fbzuXn%iKI{I)WA@lRK2I}`-_zC8!_&*t$1~WI?aA{D^#lt% zuY2}*PI%6GE_g0_E_<$eu6u5JZhNs;>XmzyUX8bwx31UdHG31iUAz;$>%7~&d%VZJ z-*|uW{^I@Bd&PUxd&hgv`_TK?C-zBwN?%={#b@<7d~RO@Uy84(ueq+|*I2V^YVa zzK}XGb#iJjRY+Z%dL;F>-{`md>-n4doBKQXJNtY1hxl{+Bm71FQT`Ht&_C7xl7E_i zrhm47v45$5x&L+l8vk1VdjAgp`~DC7ANxP?AMqdapYWgZf9e0xf5G457yqwmJ< Int { + let calendar = Calendar.current + + let startOfSelf = calendar.startOfDay(for: self) + let startOfOther = calendar.startOfDay(for: otherDate) + let components = calendar.dateComponents([.day], from: startOfSelf, to: startOfOther) + + return abs(components.day ?? 0) + } +} + diff --git a/TymateSwiftExtensions/StringExtensions.swift b/TymateSwiftExtensions/StringExtensions.swift index 4f5e861..539861b 100644 --- a/TymateSwiftExtensions/StringExtensions.swift +++ b/TymateSwiftExtensions/StringExtensions.swift @@ -10,8 +10,7 @@ import Foundation public extension String { func isValidEmail() -> Bool { - // print("validate calendar: \(testStr)") - let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}" + let emailRegEx = "(?:[a-zA-Z0-9!#$%\\&‘*+/=?\\^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%\\&'*+/=?\\^_`{|}” + “~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\” + “x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-” + “z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5” + “]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-” + “9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21” + “-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])" let emailTest = NSPredicate(format: "SELF MATCHES %@", emailRegEx) return emailTest.evaluate(with: self) @@ -32,6 +31,11 @@ public extension String { return "https://" + withoutHttps } + func withPrefix(_ prefix: String) -> String { + if self.hasPrefix(prefix) { return self } + return "\(prefix)\(self)" + } + func phoneCall() { if let url = URL(string: "tel://\(self)"), UIApplication.shared.canOpenURL(url) { if #available(iOS 10, *) { @@ -80,4 +84,9 @@ public extension String { func isEqualToZero() -> Bool { return self.toFloat() == 0 } + + func wordCount() -> Int { + let regex = try? NSRegularExpression(pattern: "\\w+") + return regex?.numberOfMatches(in: self, range: NSRange(location: 0, length: self.utf16.count)) ?? 0 + } }