UIButton Not Working After Update to Xcode 8.3

After I updated to Xcode 8.3 the following code is not working in Xcode Playgrounds. Before on Xcode 8.2.1, I was able to click on the button and the action would follow, but now nothing is happening when I click the button.

class Responder: NSObject {
    @objc func nextScene() {
          print("touched")
    }
}
let responder = Responder()
let canvas = IntroductionSceneVariables.canvas
let nextButton = UIButton(type: .system)
nextButton.frame = CGRect(x: 250, y: 557.5, width: 40, height: 15)
nextButton.setTitle("Next", for: .normal)
nextButton.titleLabel?.font = UIFont(name: "Marker Felt", size: 17)
nextButton.tintColor = .black
nextButton.addTarget(responder, action: #selector(Responder.nextScene), for: .touchUpInside)
canvas.addSubview(nextButton)

I had a shot at replicating your issue but I got stuck on

IntroductionSceneVariables
. Where does this come from? Perhaps you could distill this down into an example that I can paste into a newly created iOS playground?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

When I was creating the code that you could paste into a Playground, it started to work! Yesterday the same code didn't work, but today it does. For reference here is my edited code.


import UIKit
import SpriteKit
import PlaygroundSupport

let view = SKView(frame: CGRect(x: 0, y: 0, width: 550, height: 575))
let scene = SKScene(size: CGSize(width: 550, height: 575))
scene.backgroundColor = UIColor.white
scene.scaleMode = SKSceneScaleMode.aspectFit
view.presentScene(scene)

class Responder: NSObject {
    @objc func nextScene() {
        print("Next button pressed!")
    }
}
let responder = Responder()

let nextButton = UIButton(type: .system)
nextButton.frame = CGRect(x: 250, y: 557.5, width: 40, height: 15)
nextButton.setTitle("Next", for: .normal)
nextButton.titleLabel?.font = UIFont(name: "Marker Felt", size: 17)
nextButton.tintColor = .black
nextButton.addTarget(responder, action: #selector(Responder.nextScene), for: .touchUpInside)
view.addSubview(nextButton)

PlaygroundPage.current.liveView = view
UIButton Not Working After Update to Xcode 8.3
 
 
Q