Swift 3 Support
Hi,
Are there any intentions for an update to support Swift 3 for this library? If not I'm happy to take a stab at it and submit a PR if you're open to it.
Thanks for a great library!
Yeah - definitely got plans to update/maintain it for Swift 3. Need to look through the some of the changes in Foundation though - as ideally would like to improve the underlying decimal number maths to be more Swifty/ValueType.
Will have some progress during the week I expect.
Unfortunately at the moment, this is sort of reliant on Swift 3.0 version of ValueCoding too, which has it's own issues, see: https://github.com/danthorpe/ValueCoding/pull/18.
There is a pull request, #55 which has Swift 3.0 support for Money.
There are a few breaking changes - mostly around Locale getting its name taken by NSLocale, so this is now Localization.
Similarly there are number of other Swift 3.0 style name changes.
Hey @danthorpe sorry for the question but to use the branch of Swift 3 with pods... I've being trying to use it and still pulls the one for 2.3, again sorry, may be something really dumb to do.
@danthorpe I'm still getting lots of errors when building Swift 3 project with your #55 PR.
I'm using Money through Cocoapods.
pod 'Money',
:git => 'https://github.com/danthorpe/Money.git',
:branch => 'swift/3.0'
Using the latest swift/3.0 branch commit (44199cde8ecbeeca09ae9d54c7ccc982bfbe8d8c) lets me build Money in my Swift 3 app, but since Money.podspec still points to ValueCoding 1.5 as its dependency (instead of ValueCoding 2.x, which is the version written in Swift 3), I cannot use Money through CocoaPods.
What is the recommended workaround for using Money in a Swift 3 app at present? Should I not be using CocoaPods to install Money?
Hi @msewell - yeah, sorry - known issue r.e. the .podspec will hopefully get this sorted asap - ran out of time at the weekend.
Done! Sorry it took so long to update - real job and ProcedureKit have got in the way! Anyway, can now do this
pod 'Money', '~> 2'
for CocoaPods, or this:
github "danthorpe/Money" "~> 2"
for Carthage.
Thanks @danthorpe for your hard work! T("T)
Just updating a project to swift 3 and using the suggest line above
pod 'Money', '~> 2
I get this error on pod install
Analyzing dependencies
[!] Unable to satisfy the following requirements:
- `Money (~> 2)` required by `Podfile`
None of your spec sources contain a spec satisfying the dependency: `Money (~> 2)`.
You have either:
* out-of-date source repos which you can update with `pod repo update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
I assume I've missed something simple, any help would be great
@danthorpe I am getting the same as @simonbarker
Hi @danthorpe ! I am using Money 2.0.1 for my Swift 3.2 project using Xcode 9.0 and I getting some errors like this:
is there something I've missed? thanks
Hi @omdika - You can point your pod to this branch: feature/MNY-79_updates_for_xcode_9 which builds for Swift 3.2. Please feedback to PR #84 .
It's not yet 100% complete - let me know how you go. There were lots of sneaky changes related to decimal support in Swift 3.2.
Thanks for your quick help @danthorpe , previous error is missing now. But there is another one:
have I missed something?
Yeah, haven't spent much time with custom currencies at the moment, and CustomCurrencyType doesn't exist anymore. Or at least, not at the moment.
Instead, you can try conforming to CurrencyProtocol instead. You are the first person to bump into this.