@@ -43,10 +43,14 @@ final class AvatarTrainView: UIView {
4343 // redraw border when user interface style changes.
4444 if let previousTraitCollection = previousTraitCollection,
4545 previousTraitCollection. userInterfaceStyle != traitCollection. userInterfaceStyle {
46- avatarStackView . subviews . forEach { configureBorder ( for : $0 ) }
46+ configureAvatarBorders ( )
4747 }
4848 }
4949
50+ override func layoutSubviews( ) {
51+ configureAvatarBorders ( )
52+ }
53+
5054}
5155
5256// MARK: Private Helpers
@@ -62,7 +66,6 @@ private extension AvatarTrainView {
6266 func makeAvatarImageView( with avatarURL: URL ? = nil ) -> UIImageView {
6367 let imageView = CircularImageView ( image: placeholderImage)
6468 imageView. translatesAutoresizingMaskIntoConstraints = false
65- configureBorder ( for: imageView)
6669
6770 NSLayoutConstraint . activate ( [
6871 imageView. heightAnchor. constraint ( equalToConstant: imageHeight) ,
@@ -76,9 +79,12 @@ private extension AvatarTrainView {
7679 return imageView
7780 }
7881
79- func configureBorder( for view: UIView ) {
80- view. layer. borderWidth = Constants . borderWidth
81- view. layer. borderColor = UIColor . listForeground. cgColor
82+ func configureAvatarBorders( ) {
83+ avatarStackView. arrangedSubviews. forEach { view in
84+ view. layer. masksToBounds = true
85+ view. layer. borderWidth = Constants . borderWidth
86+ view. layer. borderColor = UIColor . listForeground. cgColor
87+ }
8288 }
8389
8490 // MARK: Constants
0 commit comments