↧
Answer by Clifton Labrum for Replace Substring with Markdown on NSTextView in...
It looks like this works: let range = content.selectedRange() markdownText = content.string if let index = Range(range, in: markdownText){ content.replaceCharacters(in: range, with:...
View ArticleAnswer by Dávid Pásztor for Replace Substring with Markdown on NSTextView in...
You should use the replaceCharacters(in:with:) method of NSText (whose subclass NSTextView is). @IBAction func clickBold(_ sender: NSButton) { let range = content.selectedRange() let selectedText =...
View ArticleReplace Substring with Markdown on NSTextView in Swift
Swift 5, Xcode 11 In a Stack Overflow text editor, you can select some text (like "selected" below), click the bold button, and it replaces: Text selected here. ...with this: Text **selected** here....
View Article