I am newbie to iOS/Swift. I am developing app using Swift4 on XCode12. But I have a problem with presenting UIViewController.
Below is my code:
import UIKit
import CoreGraphics
class NewController: UIViewController {
    override func viewDidAppear(_ animated: Bool) {
        let cancelButton = UIButton()
        
        cancelButton.frame = CGRect(
            x: view.frame.width/2 - 30,
            y: view.frame.height - 120,
            width: 60,
            height: 44)
        cancelButton.setTitle("Cancel", for: .normal)
        cancelButton.backgroundColor = UIColor.systemGreen
        cancelButton.contentMode = .scaleAspectFit
        view.addSubview(cancelButton)
    }
}
class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func viewDidAppear(_ animated: Bool) {
        let n1 = NewController()
        //self.navigationController?.pushViewController(n1, animated: true)
        self.present(n1, animated: true, completion: nil)
    }
}
But it shows like this image. Image before/after presenting
As you can see in the image, it shows black margin after presenting NewController.
Anybody can help me?
I tested on simulator iPhone 8 (iOS 14.2).
 
    