I'm trying to replace last three characters with "*", but I do not think I'm doing it okay. I'll share my code below :
//This is the string and is looking like this : 07123456789
var phoneNumber = viewModel.securityAndLoginAssetsData?.userProfile.phones.phoneLogin
let endIndex = phoneNumber!.index(phoneNumber!.startIndex, offsetBy: -3)
var finalPhoneNumber = phoneNumber!.replaceSubrange(...endIndex, with: "*")
This is how I'm trying to display it, but I got this error : "Type '()' cannot conform to 'StringProtocol'"
Text(finalPhoneNumber)
What can I do in this case, thanks :)