I have page view controller and want to remove it and go back to homeviewcontroller, but when i call
self.view.removeFromSuperview()
it show black screen instead of remove it and go back to parent
You shouldn't use removeFromSuperView() on view controller views. Instead use self.dismiss(animated: true, completion: nil)
if you presented it modally, or use navigationController?.popViewController(animated: true)
if you pushed it.