-
Notifications
You must be signed in to change notification settings - Fork 64
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
Time != Money #10
Conversation
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` |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Sources/TaggedTime/TaggedTime.swift
Outdated
return .init(rawValue: self.rawValue / 1000) | ||
} | ||
|
||
public var date: Date { |
There was a problem hiding this comment.
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.
@mbrandonw Think this is finally ready! |
@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 👍 🏷😎 |
@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! |
@JRHeaton merged! Thanks for the nudge to get this across the finish line! |
@mbrandonw Awesome! Nice work on this. |
* 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
Adding the
TaggedTime
andTaggedMoney
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.