Skip to content

Commit

Permalink
Use String APIs, not NSString ones
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesyo committed Oct 31, 2015
1 parent 33d81fe commit 43d1762
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Source/CarthageKit/Git.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public struct GitURL: Equatable {
/// Strips any trailing .git in the given name, if one exists.
public func stripGitSuffix(string: String) -> String {
if string.hasSuffix(".git") {
return string.substringToIndex(string.endIndex.advancedBy(-4))
return string[string.startIndex..<string.endIndex.advancedBy(-4)]
} else {
return string
}
Expand Down Expand Up @@ -184,11 +184,9 @@ public func listTags(repositoryFileURL: NSURL) -> SignalProducer<String, Carthag
return launchGitTask([ "tag" ], repositoryFileURL: repositoryFileURL)
.flatMap(.Concat) { (allTags: String) -> SignalProducer<String, CarthageError> in
return SignalProducer { observer, disposable in
let string = allTags as NSString

string.enumerateSubstringsInRange(NSMakeRange(0, string.length), options: [ .ByLines, .Reverse ]) { line, substringRange, enclosingRange, stop in
allTags.enumerateSubstringsInRange(allTags.characters.indices, options: [ .ByLines, .Reverse ]) { line, substringRange, enclosingRange, stop in
if disposable.disposed {
stop.memory = true
stop = true
}

if let line = line {
Expand Down

0 comments on commit 43d1762

Please sign in to comment.