Confirming to protocol inside view controller programmatically?

Hello!
No idea if the title makes sense but I am trying to accomplish something like this programmatically.
“override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
switch segue.identifier {
case “embedContainerViewController”:
guard let moodsConfigurable = segue.destination as? MoodsConfigurable else {
preconditionFailure(
“View controller expected to conform to MoodsConfigurable”)
}
self.moodsConfigurable = moodsConfigurable
segue.destination.additionalSafeAreaInsets =
UIEdgeInsets(top: 0, left: 0, bottom: 160, right: 0)
default:
preconditionFailure(“Unexpected segue identifier”)
}
}”

and since I am not using storyboard, there’s no segue to cast. My question is how do I achieve the same thing in code?
Also this is from chapter 17 of the iOS programming book. I am trying to do the Mandela project all in code and I am struggling with this part.

The above quote is from the book chapter 17.17 or the last section of that chapter.
Thanks.