diff --git a/.swift-version b/.swift-version deleted file mode 100644 index 5186d07..0000000 --- a/.swift-version +++ /dev/null @@ -1 +0,0 @@ -4.0 diff --git a/Gemfile b/Gemfile index 9f4c01e..948cd7a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ source "https://rubygems.org" +gem "cocoapods" gem "synx" gem "jazzy" diff --git a/Gemfile.lock b/Gemfile.lock index faed3b7..d7c80d5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,79 +1,82 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (2.3.5) - activesupport (4.2.9) + CFPropertyList (2.3.6) + activesupport (4.2.10) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + atomos (0.1.2) claide (1.0.2) clamp (0.6.5) - cocoapods (1.3.1) + cocoapods (1.4.0) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.3.1) - cocoapods-deintegrate (>= 1.0.1, < 2.0) + cocoapods-core (= 1.4.0) + cocoapods-deintegrate (>= 1.0.2, < 2.0) cocoapods-downloader (>= 1.1.3, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.2.0, < 2.0) + cocoapods-trunk (>= 1.3.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) fourflusher (~> 2.0.1) gh_inspector (~> 1.0) - molinillo (~> 0.5.7) + molinillo (~> 0.6.4) nap (~> 1.0) ruby-macho (~> 1.1) - xcodeproj (>= 1.5.1, < 2.0) - cocoapods-core (1.3.1) + xcodeproj (>= 1.5.4, < 2.0) + cocoapods-core (1.4.0) activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.1) + cocoapods-deintegrate (1.0.2) cocoapods-downloader (1.1.3) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) cocoapods-stats (1.0.0) - cocoapods-trunk (1.2.0) + cocoapods-trunk (1.3.0) nap (>= 0.8, < 2.0) - netrc (= 0.7.8) + netrc (~> 0.11) cocoapods-try (1.1.0) colored2 (3.1.2) colorize (0.8.1) + concurrent-ruby (1.0.5) escape (0.0.4) - ffi (1.9.18) + ffi (1.9.23) fourflusher (2.0.1) fuzzy_match (2.0.4) - gh_inspector (1.0.3) - i18n (0.8.6) - jazzy (0.8.3) + gh_inspector (1.1.3) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + jazzy (0.9.1) cocoapods (~> 1.0) mustache (~> 0.99) open4 redcarpet (~> 3.2) - rouge (~> 1.5) + rouge (>= 2.0.6, < 4.0) sass (~> 3.4) sqlite3 (~> 1.3) xcinvoke (~> 0.3.0) liferaft (0.0.6) - minitest (5.10.3) - molinillo (0.5.7) + minitest (5.11.3) + molinillo (0.6.4) mustache (0.99.8) nanaimo (0.2.3) nap (1.1.0) - netrc (0.7.8) + netrc (0.11.0) open4 (1.3.4) - rb-fsevent (0.10.2) + rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) redcarpet (3.4.0) - rouge (1.11.1) + rouge (3.1.1) ruby-macho (1.1.0) - sass (3.5.1) + sass (3.5.5) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) @@ -84,12 +87,13 @@ GEM colorize (~> 0.7) xcodeproj (~> 1.0) thread_safe (0.3.6) - tzinfo (1.2.3) + tzinfo (1.2.5) thread_safe (~> 0.1) xcinvoke (0.3.0) liferaft (~> 0.0.6) - xcodeproj (1.5.1) + xcodeproj (1.5.6) CFPropertyList (~> 2.3.3) + atomos (~> 0.1.2) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.2.3) @@ -98,8 +102,9 @@ PLATFORMS ruby DEPENDENCIES + cocoapods jazzy synx BUNDLED WITH - 1.15.4 + 1.16.1 diff --git a/Guitar.podspec b/Guitar.podspec index 5916795..fe2d1c1 100644 --- a/Guitar.podspec +++ b/Guitar.podspec @@ -1,25 +1,29 @@ Pod::Spec.new do |s| + # Version + s.version = '0.3.1' + s.swift_version = '4.0' + + # Meta s.name = 'Guitar' - s.version = '0.3.0' s.summary = 'A Cross-Platform String and Regular Expression Library Written in Swift.' - -description = <<-DESC -A Cross-Platform String and Regular Expression Library written in Swift. + s.homepage = 'https://github.com/ArtSabintsev/Guitar' + s.social_media_url = 'https://twitter.com/artsabintsev' + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.author = { 'Arthur Ariel Sabintsev' => 'arthur@sabintsev.com' } + s.description = <<-DESC + A Cross-Platform String and Regular Expression Library written in Swift. DESC + # Deployment Targets s.ios.deployment_target = '9.0' s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.watchos.deployment_target = '3.0' - s.homepage = 'https://github.com/ArtSabintsev/Guitar' - s.license = { :type => 'MIT', :file => 'LICENSE' } - s.author = { 'Arthur Ariel Sabintsev' => 'arthur@sabintsev.com' } + # Sources s.source = { :git => 'https://github.com/ArtSabintsev/Guitar.git', :tag => s.version.to_s } - s.social_media_url = 'https://twitter.com/artsabintsev' s.framework = 'Foundation' - s.source_files = 'Sources/*.swift' end diff --git a/Sources/Guitar.swift b/Sources/Guitar.swift index dc54887..0299037 100644 --- a/Sources/Guitar.swift +++ b/Sources/Guitar.swift @@ -43,7 +43,7 @@ public struct Guitar { /// /// - Returns: A list of matches. public func evaluateForRanges(from string: String, with options: NSRegularExpression.Options = []) -> [Range] { - let range = NSRange(location: 0, length: string.characters.count) + let range = NSRange(location: 0, length: string.count) guard let regex = try? NSRegularExpression(pattern: pattern, options: options) else { return [] } diff --git a/Sources/GuitarCase.swift b/Sources/GuitarCase.swift index 216e79f..e4c2ef7 100644 --- a/Sources/GuitarCase.swift +++ b/Sources/GuitarCase.swift @@ -114,7 +114,7 @@ public extension String { @discardableResult func splitWordsByCase() -> String { var newStringArray: [String] = [] - for character in Guitar.sanitze(string: self).characters { + for character in Guitar.sanitze(string: self) { if String(character) == String(character).uppercased() { newStringArray.append(" ") } @@ -138,7 +138,7 @@ public extension String { /// - Returns: The swap cased copy of the string. @discardableResult func swapCased() -> String { - return characters.map({ + return map({ String($0).isLowercased() ? String($0).uppercased() : String($0).lowercased() }).joined() } diff --git a/Sources/GuitarPadding.swift b/Sources/GuitarPadding.swift index dfa6d27..c6e86fa 100644 --- a/Sources/GuitarPadding.swift +++ b/Sources/GuitarPadding.swift @@ -31,7 +31,7 @@ public extension String { /// - token: The string used to pad the String. Must be 1 character in length. Defaults to a white space if the parameter is left blank. /// - Returns: The padded copy of the string. func pad(length: Int, withToken token: String = " ") -> String { - guard padConditionsSatisfied(tokenCount: token.characters.count, length: length) else { return self } + guard padConditionsSatisfied(tokenCount: token.count, length: length) else { return self } let delta = Int(ceil(Double(length-count)/2)) return padLeft(length: length-delta, withToken: token).padRight(length: length, withToken: token) @@ -58,10 +58,10 @@ public extension String { /// - Returns: The left-padded copy of the string. @discardableResult func padLeft(length: Int, withToken token: String = " ") -> String { - guard padConditionsSatisfied(tokenCount: token.characters.count, length: length) else { return self } + guard padConditionsSatisfied(tokenCount: token.count, length: length) else { return self } var s = self - repeat { s.insert(token.characters[token.startIndex], at: startIndex) } while s.characters.count < length + repeat { s.insert(token[token.startIndex], at: startIndex) } while s.count < length return s } @@ -85,10 +85,10 @@ public extension String { /// - Returns: The right-padded copy of the string. @discardableResult func padRight(length: Int, withToken token: String = " ") -> String { - guard padConditionsSatisfied(tokenCount: token.characters.count, length: length) else { return self } + guard padConditionsSatisfied(tokenCount: token.count, length: length) else { return self } var s = self - repeat { s.insert(token.characters[token.startIndex], at: endIndex) } while s.characters.count < length + repeat { s.insert(token[token.startIndex], at: endIndex) } while s.count < length return s } @@ -103,7 +103,7 @@ private extension String { /// - length: The final length of the string. /// - Returns: True, if the string can be padded. Otherise, false. func padConditionsSatisfied(tokenCount: Int, length: Int) -> Bool { - guard length > characters.count, tokenCount == 1 else { return false } + guard length > count, tokenCount == 1 else { return false } return true }