Connect iPhone to your MacBook using a USB cable. Since newer MacBook doesn’t have a USB slot, you’d need the adapter – I’d suggest getting the original Apple adapter as I’ve seen cases where 3rd party cable couldn’t detect the external device
Then, run QuickTime Player > New Movie Recording
In the Record menu, select your iPhone (or name) for the camera
And that’s it!