Smart quotes for UITextView in Catalyst

Hi,


I found that setting textView.smartQuotesType = .no for a UITextView has no effect under Catalyst - it will replace standard quotes with typographic quotes anyway. Which is a bit annoying for an editor that shows code; the only workaround I found so far is to manually replace the quotes back to their original form:


text = text.replacingOccurrences(of: "“", with: "\"").replacingOccurrences(of: "„", with: "\"")


Example project for reproducing the issue: https://github.com/ralfebert/TextViewSmartQuotesExample


Anyone got the same issue/found a solution to disable smart quotes under Catalyst?


Greetings,


Ralf

Just a guess, but is this due to the Mac Keyboard system preferences that has smart quotes and dashes enabled? There's a "Use smart quotes and dashes" checkbox in System Preferences->Keyboard in the "Text" tab. Is the Mac itself directly entering smart quotes as the user types rather than the iOS/Catalyst app's text view converting them?


You could try turning that off in System Preferences to see if it affects behaviour. Of course, this isn't really a viable solution, but it might at least explain what is happening.

I had the same problem. The fix suggested does work (though I replaced the opening double quote with "”" rather than "„", because in NZ we have raised opening quotes). It is indeed a System Preference thing, and I found by turning off Keyboard | Text | Use Smart quotes and dashes I could get back to the standard double quotes. It would be good if it were possible to overide the System Preference in UITextView for people writing code editor apps.


I think though that I've opened a can of worms, because I see that the Keyboard preference has 8 different styles of double quotes

Smart quotes for UITextView in Catalyst
 
 
Q