I'd like to nest my ViewController classes within their relevant data structures, like so:
struct Book {
let title: String
}
extension Book {
struct Chapter {
let id: String
}
}
extension Book.Chapter {
class ViewController: NSViewController {
var chapter: Book.Chapter!
}
}
so that I can then refer to them as Book.Chapter.ViewController
(instead of BookChapterViewController
).
However, it seems that once I do so, I can no longer use my ViewController classes within storyboards. They don't appear in the custom class selection menu and entering manually into the storyboard XML has no effect. Is there any workaround for this?
答案 0 :(得分:0)
如何通过转到ViewController
创建另一个File > New > File...
课程,并将其命名为MyViewController
,将其与StoryBoard
相关联,然后将您的课程设为{ {1}} extension Book.Chapter
的子类?
从未尝试过,但我认为它会起作用。告诉我它是怎么回事:))