Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Fixed characters deprecation warnings. Updated meta data
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtSabintsev committed Mar 15, 2018
1 parent d88afd4 commit d0b54a6
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 45 deletions.
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source "https://rubygems.org"

gem "cocoapods"
gem "synx"
gem "jazzy"
57 changes: 31 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
Expand All @@ -98,8 +102,9 @@ PLATFORMS
ruby

DEPENDENCIES
cocoapods
jazzy
synx

BUNDLED WITH
1.15.4
1.16.1
22 changes: 13 additions & 9 deletions Guitar.podspec
Original file line number Diff line number Diff line change
@@ -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' => '[email protected]' }
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' => '[email protected]' }
# 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
2 changes: 1 addition & 1 deletion Sources/Guitar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public struct Guitar {
///
/// - Returns: A list of matches.
public func evaluateForRanges(from string: String, with options: NSRegularExpression.Options = []) -> [Range<String.Index>] {
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 []
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/GuitarCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ")
}
Expand All @@ -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()
}
Expand Down
12 changes: 6 additions & 6 deletions Sources/GuitarPadding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}

Expand Down

0 comments on commit d0b54a6

Please sign in to comment.