A Swift package that tries its best to transform strings to AP style title case.
import SwiftTitleCase
let titleCased = "mango baby is a product under mango umbrella".titleCase()
print(titleCased) // Mango Baby Is a Product Under Mango Umbrella
Mango Umbrella has an in-house client app managing its content. I needed a convenience button that automatically transforms my blog post's titles to AP style title case. So I wrote a basic function just doing that.
Currently the implementation only handles the basic rules. It doesn't attempt to identify parts of speech contextually. For example, if "up" is used as an adverb rather than a preposition, this package would still lowercase it (unless it's the first or last word). Contributions welcome!
See CHANGELOG.md.
SwiftTitleCase is licensed under the terms of the Apache license. See LICENSE for more information.