Here's a pre-Xcode-8 Swift call ..
func gappizeAtDoubleNewlines()
    {
    let t = self.text!
    var index = t.startIndex
    var follow = index.advancedBy(1)
    for i in 0 ..< (t.characters.count-4)
        {
        let r = index ... follow
        if ( t.substringWithRange(r) == "\n\n" )
            { alterLineGapHere(i) }
        index = index.advancedBy(1)
        follow = index.advancedBy(1)
        }
    }
using the automatic upgrade to Swift3, I got these errors...
in text,
func gappizeAtDoubleNewlines()
    {
    let t = self.text!
    var index = t.startIndex
    var follow = <#T##Collection corresponding to `index`##Collection#>.index(index, offsetBy: 1)
    for i in 0 ..< (t.characters.count-4)
        {
        let r = index ... follow
        if ( t.substring(with: r) == "\n\n" )
            { alterLineGapHere(i) }
        index = <#T##Collection corresponding to `index`##Collection#>.index(index, offsetBy: 1)
        follow = <#T##Collection corresponding to `index`##Collection#>.index(index, offsetBy: 1)
        }
    }
What is the solution in Swift3 ??

 
     
    