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.
Jordan > On Oct 6, 2016, at 14:07, Tyler Stromberg via swift-dev <swift-dev@swift.org> > wrote: > > 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 > _______________________________________________ > swift-dev mailing list > swift-dev@swift.org > https://lists.swift.org/mailman/listinfo/swift-dev
_______________________________________________ swift-dev mailing list swift-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-dev