[swift-users] extension on UISlider breaks interface builder??

Jon Shier jon at jonshier.com
Fri Jul 14 22:53:07 CDT 2017


	Yep, known issue, fixed in Xcode 9 beta 3 according to the release notes. Hugely annoying, but comment out the extension, connect the outlet, and comment it back it and should work fine. 


Jon

> On Jul 14, 2017, at 11:51 PM, David Baraff via swift-users <swift-users at swift.org> wrote:
> 
> TL;DR
> Add an extension to UISlider and interface builder in xcode will no longer believe it has *any* actions.
> Is this a known issue?
> 
> 
> 1. I added a UISlider to a storyboard in xcode.  I right clicked on it, and saw the usual set of things, particularly, actions (sent events):
> 
> <PastedGraphic-1.tiff>
> 
> Next, I wrote this:
> 
> public protocol ModelDataValuedUIControl: class {
>     var xxcontrolValue:Any {
>         get set
>     }
> }
> 
> extension UISlider : ModelDataValuedUIControl {
>     public var xxcontrolValue:Any {
>         get {
>             return self.value
>         }
>         
>         set(newValue) {
>             self.value = newValue as! Float
>         }
>     }
> }
> 
> 
> Lo and behold, after compiling, interface builder *hates* sliders, because now the rightclick menu looks like this:
> <PastedGraphic-2.tiff>
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users



More information about the swift-users mailing list