Display a ViewController inside another View Xcode

623 Views Asked by At

Okay so I know that you can embed a ViewController inside a view. But the situation I have is a little different

I have an app which is using an external monitor. When the monitor is connected, I'd like to display the ExternalMonitor ViewController inside another view on my iPad screen. Like a Live Preview. I can't work out how to get it to display the ViewController on both my ExternalMonitor and my PreviewView at the same time.

Basically: 1 ViewController displayed in 2 places at the same time, scaled to fit the two different views.

Is this possible. Can someone point me in the right direction?

I apologise if my terminology isn't right. I am quite new to Xcode and swift.

2

There are 2 best solutions below

0
Yevgeniy Leychenko On BEST ANSWER

While someone might offer a better solution to this, you might try displaying 2 instances of the same view controller class in 2 different places. It won't work of course, if this controller should respond to user actions. They will not be in sync that way.

0
Diksha235 On

You can use a common UIView in multiple view controllers for e.g we do use in making common headers and footers , but according to my point of view this is not possible to use 2 instances of a view controller at the same time . It will got clashed , may be it will work sequencely one after another but not on same time.