Skip to content

Instantly share code, notes, and snippets.

@iamazhar
Last active April 22, 2019 06:23
Show Gist options
  • Select an option

  • Save iamazhar/acd174b8a4dbce6c7badc5a096729e41 to your computer and use it in GitHub Desktop.

Select an option

Save iamazhar/acd174b8a4dbce6c7badc5a096729e41 to your computer and use it in GitHub Desktop.
// MARK: - View
public class BirdView: UIView {
public let imageView: UIImageView
public let nameLabel: UILabel
public let purchaseFeeLabel: UILabel
public override init(frame: CGRect) {
var imageViewFrame = CGRect(x: 0, y: 16, width: frame.width, height: frame.width/2)
imageView = UIImageView(frame: imageViewFrame)
imageView.contentMode = .scaleAspectFit
let nameLabelFrame = CGRect(x: 0, y: imageViewFrame.height + 24, width: imageViewFrame.width, height: 30)
nameLabel = UILabel(frame: nameLabelFrame)
nameLabel.textAlignment = .center
let purchaseFeeLabelFrame = CGRect(x: 0, y: imageViewFrame.height + 46, width: imageViewFrame.width, height: 30)
purchaseFeeLabel = UILabel(frame: purchaseFeeLabelFrame)
purchaseFeeLabel.textAlignment = .center
super.init(frame: frame)
backgroundColor = .white
addSubview(imageView)
addSubview(nameLabel)
addSubview(purchaseFeeLabel)
}
@available(*, unavailable)
public required init?(coder: NSCoder) {
fatalError("init?(coder:) is not supported")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment