Not able to set live view from contents.swift in a playgroundbook

Hello,

I was just using the author template for creating playgroundbooks in XCode 10.1. I tried to set the live view from the LiveView.swift of the playground page and it works completely fine. However when I try to do that from Contents.swift, it doesn't work. What could be the reason for it? I am doing it this way:


    let vc = ViewController2()
    PlaygroundPage.current.liveView = vc


As said above, this code works just fine in LiveView.swift but doesn't work in Contents.swift. ViewController2 is in the Sources folder.


Thanks!