<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi, Tyler. Swift doesn't guarantee stable addresses for anything but top-level and static variables, so you'd have to declare a 'var' to make a valid KVO context anyway. It's not a great situation, but it's unlikely to change any time soon.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 6, 2016, at 14:07, Tyler Stromberg via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">Hey everyone,</span><div class=""></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">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 <i class="">UnsafeMutableRawPointer?. </i>Is there ever a need to mutate this parameter, and if not can we change it to be <i class="">UnsafeRawPointer? </i>instead?</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">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.)</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">Thanks,</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">-Tyler</span></div><div class=""></div></div>_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></div></blockquote></div><br class=""></body></html>