Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

acceptsFirstResponder in NSViewController and xcode 6 - Swift

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?

like image 630
Ron Avatar asked Sep 04 '14 01:09

Ron


1 Answers

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
like image 61
Chris Avatar answered Nov 20 '22 13:11

Chris