Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support changing text case #26

Closed
ZevEisenberg opened this issue Jun 18, 2015 · 3 comments
Closed

Support changing text case #26

ZevEisenberg opened this issue Jun 18, 2015 · 3 comments
Milestone

Comments

@ZevEisenberg
Copy link
Collaborator

A BONText should be able to specify that its string will be transformed to uppercase, lowercase, and title case.

@ZevEisenberg
Copy link
Collaborator Author

Don't forget all caps! Also, I'm thinking it should probably always use the localized version of those string transformations, and pass [NSLocale locale]. But it might need to be able to take a locale parameter in order to be testable?

@ZevEisenberg
Copy link
Collaborator Author

ZevEisenberg commented May 23, 2016

Maybe something like this: .case(.Title), and you can optionally call .case(.Title).locale(someLocale), which sets a locale property on the underlying BONText. The locale would default to [NSLocale currentLocale]' or nil, depending on which one makes more sense in the implementation, if you don’t pass a locale.

Alternatively, we could have two different block properties: .case(.Title) and .case(.Title, someLocale). This two-parameter block property has precedence with .fontNameAndSize(@"someFont", 17.0), but in the text case example, it doesn't allow for as much composability.

A final option would be to always require a locale parameter, but you could pass nil to specify the current locale. That would get users of the API to think more about locale when capitalizing strings, which they might otherwise not do, but we have to draw the line somewhere in terms of babysitting developers.

@KingOfBrian KingOfBrian added this to the 4.1 milestone Oct 3, 2016
@ZevEisenberg
Copy link
Collaborator Author

It sounds like there are big changes coming in String localizability in Swift 4 and beyond: https://github.com/apple/swift/blob/master/docs/StringManifesto.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants