Skip to content

🗞 Swift String extension for typographically correct quotes & apostrophes

License

Notifications You must be signed in to change notification settings

hallee/swift-smart-quotes

Repository files navigation

SmartQuotes

A simple Swift String extension for converting straight apostrophes and quotes in to typographically correct curly versions.

This package provides a .withSmartQuotes property on String, which defaults to English conversions.

For other localizations, a locale can be provided to .withSmartQuotes(locale: Locale?). Currently only de, fi, and sv are implemented. I’m open to contributions for other localizations!

Usage

import SmartQuotes

"\"Crime peaked in the '90s\"".withSmartQuotes   // “Crime peaked in the ’90s”

"\"Crime peaked in the '90s\"".withSmartQuotes(  // „Crime peaked in the ‘90s“
    Locale(identifier: "de")
)

Installation

Carthage

# Cartfile
github "hallee/swift-smart-quotes" ~> 0.0.1

CocoaPods

# Podfile
pod 'SmartQuotes'

SwiftPM

dependencies: [
    .package(url: "https://github.com/hallee/swift-smart-quotes", from: "0.0.1")
],
targets: [
    .target(name: "YourTarget", dependencies: ["SmartQuotes"])
]

TODO

  • Localizations

About

🗞 Swift String extension for typographically correct quotes & apostrophes

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages