[swift-users] extension on UISlider breaks interface builder??
Jon Shier
jon at jonshier.com
Fri Jul 14 22:58:15 CDT 2017
In my experience, yes, it started with Xcode 8, though I don’t specifically remember extending types I was using in IB in Xcode 7.
Jon
> On Jul 14, 2017, at 11:54 PM, David Baraff <davidbaraff at gmail.com> wrote:
>
>>
>> On Jul 14, 2017, at 8:53 PM, Jon Shier via swift-users <swift-users at swift.org <mailto: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 <mailto:swift-users at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-users <https://lists.swift.org/mailman/listinfo/swift-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170714/6c05e21e/attachment.html>
More information about the swift-users
mailing list