nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.92k stars 639 forks source link

auto convert single quotes to double quotes #1477

Closed mesqueeb closed 1 year ago

mesqueeb commented 1 year ago

I'm coming from TypeScript and in all my projects we have single quote strings. I'm so used to typing single quotes, can this auto-formatter be set up so it auto-converts my single quotes to double quotes?

nicklockwood commented 1 year ago

This would be fairly easy to add, but I think this would not be a good rule for SwiftFormat in general, for two reasons:

1) SwiftFormat is kind of a cumbersome way to apply this - you'd either need to invoke a command line or use the Xcode extension, but either of those could be done just as easily using a script or shortcut that does a simple find and replace.

2) It's possible that Swift will eventually add single quotes to the language, with a different meaning (e.g. to represent a single character, as they do in C) and then the rule would have to be removed.