Created
July 28, 2014 22:26
-
-
Save rodericj/b7931d12152cf78fe45d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/AetherCone/AetherCone/TuneKey.swift b/AetherCone/AetherCone/TuneKey.swift | |
index 7332d8d..62218c2 100644 | |
--- a/AetherCone/AetherCone/TuneKey.swift | |
+++ b/AetherCone/AetherCone/TuneKey.swift | |
@@ -22,7 +22,8 @@ enum TuneKey{ | |
case RdioEmptyKey | |
init(_ key:String){ | |
- switch key.substringToIndex(1){ | |
+ var firstLetter : String = key.bridgeToObjectiveC().substringWithRange(NSMakeRange(0,1)) | |
+ switch firstLetter { | |
case "t": self = .RdioTrackKey(key) | |
case "r": self = .RdioArtistKey(key) | |
case "a": self = .RdioAlbumKey(key) | |
@@ -60,7 +61,12 @@ enum TuneKey{ | |
default: break | |
} | |
} | |
- return countElements(ret)>0 ? ret.substringToIndex(countElements(ret)-1) : "" // to remove trailing comma | |
+ if countElements(ret) > 0 { | |
+ let commaPlacement = countElements(ret) - 1 | |
+ let retWithoutComma = ret.bridgeToObjectiveC().substringWithRange(NSMakeRange(0,commaPlacement)) | |
+ return retWithoutComma | |
+ } | |
+ return "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment