[swift-dev] KVO Context Param

Tyler Stromberg tylers at mac.com
Thu Oct 6 16:03:16 CDT 2016


Hey everyone,

One of the things that came up in a code review today was the type of KVO's context param. If you look at the function signature it gets imported as UnsafeMutableRawPointer?. Is there ever a need to mutate this parameter, and if not can we change it to be UnsafeRawPointer? instead?

We commonly define a constant (e.g. kvoContext = 0) to pass in, but in Swift we have to make it mutable (which we'd rather not do). Is there another workaround? How is everyone else handling this? (We avoid KVO whenever possible, but some APIs require it.)

Thanks,

-Tyler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20161006/1d74c449/attachment.html>


More information about the swift-dev mailing list