override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
//I would like the profile Image View and the username button to be on the topAnchor of the postImageView. I don't know how to do this programmatically. Maybe I have to make new constraints but I am not sure how to approach this. I would appreciate it if you could make edits to the code and let me know how to tackle this issue.
addSubview(profileImageView)
profileImageView.anchor(top: topAnchor, left: leftAnchor,
paddingTop: 14, paddingLeft: 14)
profileImageView.setDimensions(height: 58, width: 58)
profileImageView.layer.cornerRadius = 58 / 2
addSubview(usernameButton)
usernameButton.centerY(inView: profileImageView,
leftAnchor: profileImageView.rightAnchor, paddingLeft: 10)
addSubview(optionsButton)
optionsButton.centerY(inView: profileImageView)
optionsButton.anchor(right: rightAnchor, paddingRight: 12)
addSubview(postImageView)
postImageView.anchor(top: profileImageView.bottomAnchor, left: leftAnchor, right: rightAnchor,
paddingTop: 10)
postImageView.heightAnchor.constraint(equalTo: widthAnchor, multiplier: 1).isActive = true
addSubview(playerView)
playerView.anchor(top: profileImageView.bottomAnchor, left: leftAnchor, right: rightAnchor,
paddingTop: 8)
playerView.heightAnchor.constraint(equalTo: widthAnchor, multiplier: 1).isActive = true
configureActionButtons()
addSubview(likesLabel)
likesLabel.anchor(top: likeButton.bottomAnchor, left: leftAnchor, paddingTop: -2,
paddingLeft: 10)
addSubview(captionLabel)
captionLabel.anchor(top: usernameButton.bottomAnchor, left: leftAnchor, right: rightAnchor,
paddingLeft: 10, paddingRight: 8)
addSubview(postTimeLabel)
postTimeLabel.anchor(top: captionLabel.bottomAnchor, left: leftAnchor, paddingLeft: 10)
}