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

David Baraff davidbaraff at gmail.com
Fri Jul 14 22:54:57 CDT 2017


> On Jul 14, 2017, at 8:53 PM, Jon Shier via swift-users <swift-users at swift.org> wrote:
> 
> 	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. 

thank you!  Just to clarify, this isn’t new breakage in xcode 9, but something broken in xcode 8, yes?
all the more reason to want swift 4 and xcode 9 then...
> 
> 
> 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
> 
> _______________________________________________
> 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