Sorry, I made a mistake in my previous post
it is truly a NSWindowController
first the code:
/ test.swift
// adminSQL
//
// Created by Patrice Rapaport on 13/12/2019.
// Copyright © 2019 Patrice Rapaport. All rights reserved.
//
import Cocoa
class test: NSWindowController {
override open var windowNibName: NSNib.Name? {
let els = className.components(separatedBy: ".")
if els.count > 1 {
return els[1]
} else {
return els[0]
}
}
override func windowDidLoad() {
super.windowDidLoad()
}
@IBAction func Tester(_ sender: Any) {
Swift.print("test activé")
}
}
the name of my Swift file is test.swift and the name of the xib file is test.xib
the Class of File Owner in the IB interface is test
The delegate of the window is File's Owner
In the xib file, I add a NSButton, I maintain CTRL down and I link it to the func "Tester"
when I CTRL-Click the button in the B Interface, I see: action ... File Owner Tester:
I made a github (I'm not an expert at this). adminSQL is a complete App, but in aPPDelegate I wrote:
func applicationDidFinishLaunching(_ aNotification: Notification) {
test().showWindow(self)
return;
so it ony access test file.
The link to the git directory is :
https://github.com/patricerapaport/adminSQL