7

Could somebody explain to me how I can set acceptsFirstResponder on a NSViewController in Swift and xcode 6?

The program doesn't allow any overriding of the function and says it doesn't exist in the superclass but I can also not set it as a variable like:

self.acceptsFirstResponder = true

Anybody know?

Ron
  • 1,047
  • 13
  • 18

1 Answers1

9

I had a similar issue but with a NSView Class. I was able to make this work with the following. I had to put it in the class outside any functions.

import Cocoa


class MyView: NSView, NSDraggingDestination {

//MARK: Variables

override var acceptsFirstResponder: Bool { return true }
override var opaque: Bool { return true }
var bgColor : NSColor = .yellowColor()
var lastString : String = ""
var attributes : NSMutableDictionary = [:]
var highlightNeeded = false
Chris
  • 335
  • 3
  • 10