-
Notifications
You must be signed in to change notification settings - Fork 4
Pumpmanager updates #1
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
Conversation
ps2
commented
Nov 20, 2018
- PumpManagerUI vending HUDViews
- Updates to PumpManagerStatus model
- Multiple observers of PumpManager status updates
Travis use xcode10
Update to Swift 4.2
Return correct units per hour for netBasalUnitsPerHour for boluses
…bject, and cleanup NS upload
| } | ||
| } | ||
|
|
||
| public class WeakObserverSet<Observer>: Sequence { |
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.
This is an interesting approach to tackling the problem of aggregating weak references; I wasn't aware of NSHashTable.weakObjects().
However, we can implement this generically without requiring NSObject inheritance (or relying on Obj-C classes at all). Note that it's impossible to retain complete type safety when working with class-constrained protocol types as the generic parameter, as protocols don't conform to themselves*, which is the issue we're fighting here. I wrote about experiencing this problem a few months ago but didn't get much solid feedback.
That said, here's a sketch of a pure-Swift WeakSet type. It still suffers the limitation of not being able to enforce that its generic parameter is a class or class-constrained protocol at compile-time, but I think it's an improvement over the Obj-C-reliant variant.
* There are a couple exceptions here: @objc-annotated protocols self-conform, and there's an open PR in apple/swift to do the same for Error in light of recent discussion regarding the addition of Result to the stdlib. Adding a way to self-conform a protocol in Swift has come up but doesn't have concrete plans AFAIK.