I’m building a fairly large app for macOS, and its not uncommon for a
view/view controller subclass to implement 10-20+ NSResponder methods. I
like to separate these methods from other logic/layout code. At the moment,
I’d break out my code into individual files like this:
TestViewController.swift
TestViewController+NSResponder.swift
TestViewController+…
class TestViewController: NSViewController {
}
extension TestViewController {
}
The problem is: when I try to introduce generics to the subclass, the
compiler complains about limitations on @objc extensions. The only
workaround is to concatenate everything into a larger file, which I’d
rather not do. Would it be possible to introduce a simple way to have the
compiler concatenate declarations for us? Probably creates more problems
that it solves, but worth mentioning. E.g:
class TestViewController: NSViewController {
func foo() { }
}
class TestViewController (continued) {
func bar() { }
}
Concatenates into:
class TestViewController: NSViewController {
func foo() { }
func bar() { }
}
Alternate syntax:
continued class TestViewController {
func bar() { }
}
Slightly more exotic:
TestViewController.Type += class {
func bar() { }
}
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution