Skip to content

Instantly share code, notes, and snippets.

@Cee
Created March 10, 2020 07:17
Show Gist options
  • Save Cee/e6849b981aabef9d3ff568d847ec87d6 to your computer and use it in GitHub Desktop.
Save Cee/e6849b981aabef9d3ff568d847ec87d6 to your computer and use it in GitHub Desktop.
TextField Playground
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
override func loadView() {
let view = UIView()
view.backgroundColor = .white
let textField = UITextField()
textField.borderStyle = .roundedRect
textField.frame = CGRect(x: 150, y: 200, width: 200, height: 20)
textField.placeholder = "Test"
view.addSubview(textField)
self.view = view
textField.becomeFirstResponder()
}
}
// Present the view controller in the Live View window
PlaygroundPage.current.liveView = MyViewController()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment