retweetButton.leadingAnchor.constraint(equalTo: replyButton.trailingAnchor, constant: actionSpacing),
retweetButton.centerYAnchor.constraint(equalTo: replyButton),
warning: Cannot convert value of type 'UIButton' to expected argument type 'NSLayoutAnchor'
what's problem
CodePudding user response:
You need to provide an NSLayoutAnchor here. If you check equalTo parameter, it is expecting a NSLayoutAnchor
retweetButton.centerYAnchor.constraint(equalTo: NSLayoutAnchor)
you are passing a UIButton. That's why it's giving you the error and error description is simple and straight forward.
Simply pass an NSLayoutAnchor accroding to your need where you want to place your button. Here in this case simply put centre Y anchor of replyButton error will go away. you can change this any anchor you want.
retweetButton.centerYAnchor.constraint(equalTo: replyButton.centerYAnchor)
CodePudding user response:
retweetButton.leadingAnchor.constraint(equalTo: replyButton.trailingAnchor, constant: actionSpacing)
retweetButton.centerYAnchor.constraint(equalTo: replyButton.centerYAnchor)