This is my code
class AmDocViewController: UIViewController,UITextViewDelegate {
    var text1:String!
    let replaceYName: String = "text1"
    var textA:String!
    let replaceFName: String = "textA"
    var textB:String!
    let replaceyGFName: String = "textB"
    @IBOutlet weak var myTextView: UITextView!
override func viewDidLoad() {
        super.viewDidLoad()
        myTextView.delegate = self;
        self.view.endEditing(true)
 let notes37 = NSAttributedString(string:"""
(SOME SAMPLE TEXT......)
""", attributes:[NSAttributedStringKey.foregroundColor: UIColor.gray])
 let newMutableString77 = notes37.mutableCopy() as! NSMutableAttributedString
        newMutableString77.append(notes37)
myTextView.attributedText = newMutableString77 as NSAttributedString
        let originalString = myTextView.text
        let updatedString = originalString?.replacingOccurrences(of: replaceYName, with: text1)
        let updatedString1 = updatedString?.replacingOccurrences(of: replaceFName, with: textA)
        if textB == "" {
            let updatedString2 = updatedString1?.replacingOccurrences(of: str25, with: "N/A")
        }
        if textB != ""{
            let updatedString2 = updatedString1?.replacingOccurrences(of: replaceyGFName, with: textB)
        }
        myTextView.text = updatedString2
        myTextView.textAlignment = NSTextAlignment.center
    }
Getting below error message in the if statement lines
Argument type 'NSAttributedString' does not conform to expected type 'StringProtocol'
Please advice how to use the String value received from other ViewController TextField(text1) and replace a attributed String in a TextView ?
 
    