Fixing function from swift 1.0 to 1.2

I just upgraded to the new swift and can’t figure out how to fix this function. Any ideas? I get the error below and my first and return lines:

‘(@Ivalue String!) -> _’ is not identical to ‘NSInteger’

func textView(textView: UITextView, shouldChangeTextInRange range: NSRange, replacementText text: String) -> Bool {
        var countx = count(textView.text) + (count(text) - count(range))
        var t = String(countx) + "/500"
        countText.text = t
        return count(textView.text) + (count(text) - count(range)) <= 500

Source: syntax

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.