Skip to content

Commit

Permalink
Fixed build warnings in Xcode 9.1 (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyerra authored and ldiqual committed Dec 7, 2017
1 parent bdb1d1c commit 1cb6b88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions SwiftyRSA/PublicKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ public class PublicKey: Key {
public static func publicKeys(pemEncoded pemString: String) -> [PublicKey] {

// If our regexp isn't valid, or the input string is empty, we can't move forward…
guard let publicKeyRegexp = publicKeyRegex, pemString.characters.count > 0 else {
guard let publicKeyRegexp = publicKeyRegex, pemString.count > 0 else {
return []
}

let all = NSRange(
location: 0,
length: pemString.characters.count
length: pemString.count
)

let matches = publicKeyRegexp.matches(
Expand All @@ -102,8 +102,8 @@ public class PublicKey: Key {
let match = result.rangeAt(1)
#endif

let start = pemString.characters.index(pemString.startIndex, offsetBy: match.location)
let end = pemString.characters.index(start, offsetBy: match.length)
let start = pemString.index(pemString.startIndex, offsetBy: match.location)
let end = pemString.index(start, offsetBy: match.length)

let range = Range<String.Index>(start..<end)

Expand Down
2 changes: 1 addition & 1 deletion SwiftyRSA/SwiftyRSA.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ enum SwiftyRSA {
static func format(keyData: Data, withPemType pemType: String) -> String {

func split(_ str: String, byChunksOfLength length: Int) -> [String] {
return stride(from: 0, to: str.characters.count, by: length).map { index -> String in
return stride(from: 0, to: str.count, by: length).map { index -> String in
let startIndex = str.index(str.startIndex, offsetBy: index)
let endIndex = str.index(startIndex, offsetBy: length, limitedBy: str.endIndex) ?? str.endIndex
return String(str[startIndex..<endIndex])
Expand Down

0 comments on commit 1cb6b88

Please sign in to comment.