This package is providing rational and intermediate function known as Stern Brocot Tree. I am very inspired from this article https://begriffs.com/posts/2018-03-20-user-defined-order.html and @begriffs.
Install this package from url(https://github.com/yosshi4486/SternBrocotTreeSwift) via swift package manager.
To register SBRationalToDataTransformer to CoreData attribute inspector, please follow these steps.
- Set
SBRationalToDataTransformer
toTransformer
textfield. - Set
SBRational
toCustom Class
textfield. - Set
SternBrocotTreeSwift
toModule
textfield. - Call
SBRationalToDataTransformer.register()
before setting up a persistentContainer.
Setting something to Module, xcdatamodeld/xcdatamodel/contents set combined value ModuleYouSet.CustomClassYouSet
to its internal customClass
attribute.
I have not majored math, so my understanding may not be enough. If your notice several misunderstanding of this package, I hope you make issue or pull request.
- Provide non-overflow API at first, then if it is possible to make overflow, provide reportingOverflow API.
- Follow Swift standard overflow API style whenever possible.