iOSのUIをコードで追加して配置する
5回ググって書く気が失せたのでBlogged.
// https://qiita.com/i_terasaka/items/2cf7d0f7146f32c3f2c1#%E5%8F%96%E5%BE%97%E6%96%B9%E6%B3%95 let button = UIButton(type: UIButtonType.system) button.frame = CGRect(x: 180, y: 50, width: 100, height: 40) button.setTitle("button", for: UIControlState.normal) button.accessibilityIdentifier = "button" // XCUITest用 button.addTarget(self, action: #selector(ViewController.someAction), for: UIControlEvents.touchUpInside) self.view.addSubview(button) // https://qiita.com/on0z/items/9768d2bccc29cc4e1851 var wkWebView : WKWebView! wkWebView = WKWebView(frame: CGRect(x: 100, y: 100, width: self.view.frame.size.width / 2, height: self.view.frame.size.height / 2)) self.view.addSubview(wkWebView) // 初期化メソッドに差はない var uiwebview : UIWebView! uiwebview = UIWebView(frame: CGRect(x: 100, y: 120 + self.view.frame.size.height / 4 , width: self.view.frame.size.width / 2, height: self.view.frame.size.height / 4)) self.view.addSubview(uiwebview)