extension on UISlider breaks interface builder??


(David Baraff) #1

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):

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:


(Jon Shier) #2

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@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(David Baraff) #3

  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...

···

On Jul 14, 2017, at 8:53 PM, Jon Shier via swift-users <swift-users@swift.org> wrote:

Jon

On Jul 14, 2017, at 11:51 PM, David Baraff via swift-users <swift-users@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Jon Shier) #4

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@gmail.com> wrote:

On Jul 14, 2017, at 8:53 PM, Jon Shier via swift-users <swift-users@swift.org <mailto:swift-users@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@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users