Skip to content

Instantly share code, notes, and snippets.

@farhan-syed
Created October 7, 2017 22:11
Show Gist options
  • Save farhan-syed/6767c9a260762178d050b1ab1dfe1d88 to your computer and use it in GitHub Desktop.
Save farhan-syed/6767c9a260762178d050b1ab1dfe1d88 to your computer and use it in GitHub Desktop.
import UIKit
class BSPopupView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
let alertDescription: UITextView = {
let textView = UITextView()
textView.textColor = .black
textView.text = "dfjklajdfldjasoifjlkajsofjdlsajklfdsdfjklajdfldjasoifjlkajsofjdlsajklfdsdfjklajdfldjasoifjlkajsofjdlsajklfdsdfjklajdfldjasoifjlkajsofjdlsajklfds"
textView.translatesAutoresizingMaskIntoConstraints = false
return textView
}()
func setup(){
backgroundColor = .white
topAnchor.constraint(equalTo: topAnchor, constant: 15).isActive = true
leftAnchor.constraint(equalTo: leftAnchor, constant: 15).isActive = true
addSubview(alertDescription)
alertDescription.topAnchor.constraint(equalTo: topAnchor, constant: 0).isActive = true
alertDescription.leftAnchor.constraint(equalTo: leftAnchor, constant: 0).isActive = true
alertDescription.heightAnchor.constraint(equalToConstant: self.frame.height).isActive = true
alertDescription.widthAnchor.constraint(equalToConstant: self.frame.width).isActive = true
}
func dismiss(){
removeFromSuperview()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment