CGRect 没有成员'right'?为什么 CGRect 可能不起作用?

CGRect has no member 'right'? why CGRect is not working probably?

所以我在 YouTube 上关注一个在 CGrect 中写道的人:

nameLabel.frame = CGRect( x: userProfileImage.right + 5,

此代码应该将 nameLabel 放在 userProfileImage 的右侧,但是当我使用相同的代码时,它告诉我 Value of type 'UIImageView' has no member 'right'

谁能帮我弄清楚为什么它不起作用?

黑屏是youtube上那家伙的代码没有错误,白屏是我的。相同 Xcode 版本。

那是因为 UIView 没有这样的成员,这家伙可能正在使用扩展程序或库。试试 userProfileImage.frame.maxX.