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

Time != Money #10

Merged
merged 25 commits into from
Mar 5, 2019
Merged

Time != Money #10

merged 25 commits into from
Mar 5, 2019

Conversation

mbrandonw
Copy link
Member

Adding the TaggedTime and TaggedMoney nanolibraries.

The xcodeproj and schemes changed more than I expected. I also had to manually create schemes for the new targets. Not sure if I'm doing that correctly.

@mbrandonw mbrandonw requested a review from stephencelis July 10, 2018 11:56
@stephencelis
Copy link
Member

Hm. Manual changes to the xcodeproj shouldn't be required...


The `Tagged` library also comes with a few nanolibraries for handling common types in a type safe way.

### `TaggedTime`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if we want "safe" conversion to Date, since that's a common thing to do with seconds/milliseconds and prone to errors?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, I did that but don't know if I did it correctly. check it out 257eed1


let moneyRaised: Cents<Int> = 50_000

theBigPrize.amount < moneyRaised
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also provide working (non-protocol) overloads for some of these operators if we want and if they're useful, though maybe it's always better to show an error fun accidental type overlap.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah something worth thinking about. for the time being I just updated the readme to show what it looks like to fix those compiler errors.

return .init(rawValue: self.rawValue / 1000)
}

public var date: Date {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right now this is constrained to both BinaryFloatingPoint and BinaryInteger. not sure if we can get more general than that.

@stephencelis stephencelis mentioned this pull request Nov 24, 2018
@stephencelis
Copy link
Member

@mbrandonw Think this is finally ready!

@JRHeaton
Copy link

JRHeaton commented Mar 5, 2019

@stephencelis @mbrandonw This looks great, guys! I've noticed it has seemed ready or close-to for a while now; is there anything remaining that needs to be done, and if so would you be receptive to public PR submissions to finish the work? Looking forward to this 👍 🏷😎

@mbrandonw
Copy link
Member Author

@JRHeaton Hey John! The main thing holding this up back then was that we weren't exactly sure how to support multiple cocoapods in a single repo, but I think we understand that now. We'll try to clean this up in the next few days and get it out the door!

@mbrandonw mbrandonw merged commit 73620f3 into master Mar 5, 2019
@mbrandonw mbrandonw deleted the time-money branch March 5, 2019 20:08
@mbrandonw
Copy link
Member Author

@JRHeaton merged! Thanks for the nudge to get this across the finish line!

@JRHeaton
Copy link

JRHeaton commented Mar 5, 2019

@mbrandonw Awesome! Nice work on this.

stephencelis pushed a commit that referenced this pull request Apr 9, 2019
* Coerce (#15)

* Added coerce to be able to switch between compatible representations where only the tag changes

* Change coerce to explicitly pass the new tag. Fixed spacing issues

* Renamed coerce to coerced

* Apply suggestions from code review

Incorporated fixes for argument prefix

Co-Authored-By: buscarini <buscarini@gmail.com>

* XcodeGen (#17)

* XcodeGen

* 4.2

* Bump sim

* Update package names

* Bump Xcode

* Add workspace (#18)

* Add tests for playgrounds (#20)

* Add tests for playgrounds.

* Update Makefile

Co-Authored-By: mbrandonw <mbw234@gmail.com>

* Time != Money (#10)

* Time

* Money

* typo

* podspecs

* update readme

* comment about currencies

* date conversions and more tests

* positive examples in readme

* clean up

* more cleanup

* Update README.md

* wip

* Update Tagged.podspec

* clean up

* clean u

* Bump

* Update Podspecs

* run make xcodeproj

* dependency

* make xcodeproj

* Bundle XcodeGen. Ignore Package.resolved

* Fix podspecs

* Prep pod release

* Fix pod name

* Swift 5 (#19)

* Add workspace

* Swift 5

* Bumps

* Workaround for Swift bug.

* Bumps

* Bump 2

* Podspecs

* Use Swift 5 Docker

* Conditionally include development dependencies

* Use PF-prefixed environment variable to scope

* Update TaggedTests.swift

* Revert "Update TaggedTests.swift"

This reverts commit b5bea0b.

* Update README.md

* Remove unneeded return

* Update podspecs to point to 0.4.0.

* Fixed date parsing with a custom decoding strategy

* Fixed encoding with a custom date strategy
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

Successfully merging this pull request may close these issues.

3 participants