-1

I'm trying to implement my own run() method of the NSApplication

NSApplication class has isRunning readonly property:

var isRunning: Bool { get }

This property should be true when run is called.

Apple documentation says:

The value of this property is true when the main event loop is running or false when it’s not. Calling the stop(_:) method sets the value to false.

How can I modify this readonly property and set it to true?

Andrii
  • 9
  • 2
  • By calling run() on NSApplication perhaps. – Joakim Danielson Aug 13 '23 at 10:23
  • Yes, but main point of this is to reimplement completely run() method in subclass. – Andrii Aug 13 '23 at 11:10
  • 1
    If you are not going to use the main event loop then I assume you have no use of isRunning and should add your own run state property that you manage from your subclass. – Joakim Danielson Aug 13 '23 at 11:34
  • Could you share more context around why you need to override the `run()` method? I've never run into a situation before where that's necessary; perhaps there's a better alternative to achieve your goal – Alexander Aug 13 '23 at 15:36
  • I'm making tiny cross platform framework which should support different O/S: Linux, Win and Mac. Basically it wraps code around events, windows etc. – Andrii Aug 13 '23 at 17:49
  • @Andrii Can the Application Delegate fulfill those needs? By the way, people don't get notified of your responses unless you mention them (or if it's their post) – Alexander Aug 18 '23 at 13:24

0 Answers0