Skip to content

Instantly share code, notes, and snippets.

@ConorBrady
Created April 26, 2017 10:39
Show Gist options
  • Save ConorBrady/0806c978d524f75f8cfebc38d4a51c56 to your computer and use it in GitHub Desktop.
Save ConorBrady/0806c978d524f75f8cfebc38d4a51c56 to your computer and use it in GitHub Desktop.
class MyView: UIView {
let tableView: UITableView
let textField: UITextField
let button: UIButton
init() {
tableView = UITableView(frame: .zero, style: .plain) <== {
$0.backgroundColor = .clear
$0.separatorStyle = .none
$0.contentInset = UIEdgeInsets(top: 15, left: 0, bottom: 15, right: 0)
$0.register(TableCell.self, forCellReuseIdentifier: "TableCell")
}
textField = UITextField() <== {
$0.placeholder = "Placeholder"
$0.borderStyle = .none
$0.backgroundColor = .white
$0.returnKeyType = .send
$0.rightViewMode = .always
$0.leftViewMode = .always
}
button = UIButton() <== {
$0.setImage(UIImage(named: "ButtonOne"), for: .normal)
$0.contentMode = .center
$0.frame = CGRect(x: 0.0, y: 0.0, width: 35, height: 25)
$0.layer <== {
$0.shadowOpacity = 0.2
$0.shadowOffset = CGSize(width: 0, height: 2)
$0.shadowRadius = 2
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment