Skip to content
This repository has been archived by the owner on Jul 2, 2018. It is now read-only.

Able to pass NSLocale to formatter #53

Closed
wess opened this issue Jul 12, 2016 · 3 comments
Closed

Able to pass NSLocale to formatter #53

wess opened this issue Jul 12, 2016 · 3 comments

Comments

@wess
Copy link

wess commented Jul 12, 2016

let money: Money = 99.99
print("She has \(money.formattedWithStyle(.CurrencyPluralStyle, forLocale: .Chinese(.China)))")

Ability to pass NSLocale to the forLocale param

@danthorpe
Copy link
Owner

@wess
Copy link
Author

wess commented Jul 14, 2016

I missed that, but is Locale > NSLocale?

It's how you do it here, I see:

 func formattedWithStyle(style: NSNumberFormatterStyle) -> String {
        return Currency.formattedWithStyle(style, forLocaleId: NSLocale.currentLocale().localeIdentifier)(amount)
    }

@danthorpe
Copy link
Owner

Sorry - you are quite right. Locale is not NSLocale - this is going to be a problem for Swift 3.

We can add an extension which accepts a NSLocale or identifier? Ultimately it calls though into the static method on Currency.

I can't do this until the weekend - but happy to accept a Pull Request from you if you want to add a method to the same extension in Money.swift?

danthorpe added a commit that referenced this issue Jul 17, 2016
danthorpe added a commit that referenced this issue Oct 16, 2016
* Makes formattedWithStyle forLocale public (#56)

Fixes #53.

* [development]: Removes Slather step

Generating coverage in CI just seems so unstable.

* Swift 2.3 (#61)

* [MNY-60]: Recreates Swift 2.3 framework

* [MNY-60]: Refactors CI pipeline

* [MNY-60]: Fixes upload script

* [MNY-60]: Updates build dependencies

* [MNY-60]: Shares Money scheme

Every time I forget to do this.

* [MNY-60]: Fixes deployment targets for iOS

* [MNY-60]: Fixes tvOS platform tests

* [MNY-60]: Restores minimum version of OSX to 10.11

This is to match ValueCoding

* [1.8.0]: Fixes issues raised by podspec linter

* [1.8.0]: Bumps the version to 1.8.0
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants