As a convenience, I currently subclass MASPreferencesWindowController
(from Swift, if it makes any difference), and initialise it with the various view controllers that I'd like to use in my preferences window. In MASPreferences 1.1.4, it would look something like this:
init() {
super.init(viewControllers: [FirstPreferencesViewController(),
SecondPreferencesViewController()],
title: NSLocalizedString("Preferences", comment: "Preferences Title"))
}
However, since updating to MASPreferences 1.2.1, I've noticed that I can't use an initialiser without any arguments, as I'm told that I cannot override 'init()' which has been marked unavailable: Please use initWithViewControllers:title:
. As a result, I'm having to declare my initialiser as init(_: ())
, the closest I can get to no arguments.
It seems like this line in MASPreferencesWindowController.h:72
is the cause:
- (instancetype)init __attribute((unavailable("Please use initWithViewControllers:title:")));
While I appreciate that it's a good way of preventing usage of NSObject
's default - init
initialiser (accidental or otherwise), it's annoying that it also blocks subclasses from creating their own.
As I don't think is a particularly exotic use case, would it be possible to resolve this?