Kodeco Forums

RWDevCon 2016 Session 204: Custom Controls 2

Having created a great looking control in part 1, you’ll be wondering how you can make it fully interactive, embracing the unique opportunity that touch-based devices offer. You’ll start out by creating a custom gesture recognizer, before stepping back to a more technical level and discovering how to use iOS frameworks to make a reusable, distributable package that you can share with all your friends!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1295-rwdevcon-2016-session-204-custom-controls-2

What happened at the 43:40 minute mark? It looks like a good chunk was cut out. Sam was in the middle of talking about what was going to happen, then - BOOM - he was in the middle of typing code?

Hiya,

You’re correct in noticing that we’ve lost some content in the edit - I’m guessing that there might have been some technical difficulties. Or I was deeply offensive…

Anyway, I can assure that you didn’t lose much. That point was very close to the end of the slides - just introducing gesture recognisers. As you continue to watch the video you’ll get pretty much the same info in a more practical format.

sam

Thanks. I did watch the rest and did follow along without a problem! Also, you’re explaination of content hugging etc in your other video was the best I’ve seen, thanks!

1 Like

Very good explanations, great pedagogical value ! Thank you Sam !!!

1 Like

Testing with the latest xCode (Version 8.0 (8A218a)), Swift 3.0, and the following code:

fileprivate func updateFillColor() {
let toColor = selected ? selectedColor.cgColor : color.cgColor
if !CGColorEqualToColor(toColor, fillColor) {
let animation = CABasicAnimation(keyPath: “fillColor”)
animation.fromValue = fillColor
animation.toValue = toColor
add(animation, forKey: “fillColor”)
fillColor = toColor
}
}
Get’s an error saying "CGColorEqualToColor is unavailable: Use == instead CircleLayer.swift.

Is this expected? (I’ve tried to just compile the finished project using the convert to swift 3.0 settings.

Hi @theapapp

Swift 3 introduces a much nicer API for CoreGraphics, and that includes for comparisons. I think you will probably be able to fix it by replacing the 3rd line with:

if toColor != fillColor {
  ...
}

Hope that helps

sam

1 Like