bluedevil2k/SwiftUtils — pull request #1 by markuspersson (2014-06-12 15:37:10+00:00)
Title: Fixed crash when trying to replace values received from an NSDictionary

It will crash with out of bounds when trying to call replace() on a string received from an NSDictionary. Probably because of string termination on the value contained in the NSDictionary (not quite sure).

Consider this scenario to reproduce:

var container: NSDictionary = [ "key": "myExtraLongString" ]
var stringValue = container["key"] as String
var replacedString = stringValue.replace("ExtraLong", replaceWith: "Short")

Could be quite common when developing an app with swift and objective-c at the same time.
Some network libraries haven't been updated to swift, meaning if you try to replace string values from a dictionary response you will crash (think json response).

Might not be the most elegant solution, but it does the job :)