SwiftTitleCase

0.3.1

A Swift package that transforms strings to AP style title case.
mangoumbrella/SwiftTitleCase

What's New

v0.3.1

2025-04-22T17:06:22Z

Changed

  • Downgrade the swift-tools-version to 5.8 so older toolchains can use SwiftTitleCase.

SwiftTitleCase

A Swift package that tries its best to transform strings to AP style title case.

Example usage

import SwiftTitleCase

let titleCased = "mango baby is a product under mango umbrella".titleCase()
print(titleCased)  // Mango Baby Is a Product Under Mango Umbrella

Why SwiftTitleCase?

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.

Why "tries its best"?

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!

Changelog

See CHANGELOG.md.

License

SwiftTitleCase is licensed under the terms of the Apache license. See LICENSE for more information.

Description

  • Swift Tools 5.8.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri May 16 2025 08:12:44 GMT-0900 (Hawaii-Aleutian Daylight Time)