Created
January 3, 2017 20:54
-
-
Save ranmyfriend/e7de36d473094a0429ec3d78eb259b59 to your computer and use it in GitHub Desktop.
To view the Viewcontroller child views as Live using Playground support. People who want to learn Visual Format Language(VFL) and try out how it look like. This will save lot of developer Time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
import PlaygroundSupport | |
class InputScene : UIViewController { | |
var emailTxtField:UITextField? | |
var passwordTxtField:UITextField? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.view.backgroundColor = .white | |
self.emailTxtField = UITextField.init(frame: CGRect(x:0,y:0,width:320,height:70)) | |
self.emailTxtField?.placeholder = "Email address" | |
self.emailTxtField?.addTarget(self, action: #selector(textFieldChanged), for: UIControlEvents.valueChanged) | |
self.view.addSubview(self.emailTxtField!) | |
self.passwordTxtField = UITextField.init(frame: CGRect(x:0,y:80,width:320,height:50)) | |
self.passwordTxtField?.text = "Password" | |
self.passwordTxtField?.addTarget(self, action: #selector(textFieldChanged), for: UIControlEvents.valueChanged) | |
self.view.addSubview(self.passwordTxtField!) | |
} | |
//MARK:- Selectors | |
func textFieldChanged(sender:AnyObject) {} | |
} | |
PlaygroundPage.current.liveView = InputScene() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment