My code was as below
   var theReview = addReview.text
    let len2 = addReview.text.utf16.count
    if len2 > 3000 {
        theReview = theReview?.substring(to: (theReview?.index((theReview?.startIndex)!, offsetBy: 3000))!)
    }
My aim was to get the first 3000 characters of the text if it is longer than 3000 characters.
However, I get the warning below:
'substring(to:)' is deprecated: Please use String slicing subscript with a 'partial range upto' operator
What can be an alternative to my code. I am not a very professional coder. So any help would be great.
 
     
     
     
    