> On Mar 9, 2016, at 8:42 AM, Roland King <[email protected]
> <mailto:[email protected]>> wrote:
>
> just
>
> return NSApp.mainWIndow?.contentViewController as?
> MainContentViewController
>
> works without all the guard and intermediate variables and still returns the
> same optional.
Thanks. I should have remembered this is a more direct way to do it:
lazy var mainContentViewController: MainContentViewController? = {
NSApp.mainWindow?.contentViewController as? MainContentViewController
}()
But the main thrust of my question was whether this is a safe and sensible way
to crossreference other storyboard scenes -- at least when
prepareForSegue(_:sender:) isn't available, as it isn't here. Having thought
about it for a while now, I guess it is a sensible approach. It has less to do
with storyboards than with the longstanding fact that NSApplication has a
'mainwindow' property and NSWindow has a 'contentViewController' property.
--
Bill Cheeseman - [email protected] <mailto:[email protected]>
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]