Quantcast
Channel: Replace Substring with Markdown on NSTextView in Swift - Stack Overflow
Browsing all 3 articles
Browse latest View live

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 Article



Answer 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 Article

Replace 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
Browsing all 3 articles
Browse latest View live




Latest Images