 /// :param: s1 First String
 /// :param: s2 Second String
 ///
-/// :returns: .DifferenceAtIndex(i) or .NoDifference
-public func firstDifferenceBetweenStrings(_ s1: NSString, _ s2: NSString) -> FirstDifferenceResult {
-    let len1 = s1.length
-    let len2 = s2.length
+/// :returns: .differenceAtIndex(i) or .noDifference
+public func firstDifferenceBetweenStrings(_ s1: String, _ s2: String) -> FirstDifferenceResult {
+    let len1 = s1.count
+    let len2 = s2.count
 
     let lenMin = min(len1, len2)
 
     for i in 0..<lenMin {
-        if s1.character(at: i) != s2.character(at: i) {
-            return .DifferenceAtIndex(i)
+        let i1 = s1.index(s1.startIndex, offsetBy: i)
+        let i2 = s2.index(s2.startIndex, offsetBy: i)
+        if s1[i1] != s2[i2] {
+            return .differenceAtIndex(i)
         }
     }
 
     if len1 < len2 {
-        return .DifferenceAtIndex(len1)
+        return .differenceAtIndex(len1)
     }
 
     if len2 < len1 {
-        return .DifferenceAtIndex(len2)
+        return .differenceAtIndex(len2)
     }
 
-    return .NoDifference
+    return .noDifference
 }
 
 


    if translate != expected {
        //Find text difference
        let difference = prettyFirstDifferenceBetweenStrings(translate as NSString, expected as NSString)
        XCTFail(difference)
    }
}

/// Result type for firstDifferenceBetweenStrings()
public enum FirstDifferenceResult {
    /// Strings are identical
    case noDifference

    /// Strings differ at the specified index.
    ///
    /// This could mean that characters at the specified index are different,
    /// or that one string is longer than the other
    case differenceAtIndex(Int)
}
