@@ -16,7 +16,7 @@ class CardView: UIView {
19− var width: CGFloat = 300 {
19+ var minWidth: CGFloat = 300 {
@@ -84,11 +84,15 @@ class CardView: UIView {
84 largeStack.addArrangedSubview(.spacer(vPadding1))
84 largeStack.addArrangedSubview(.spacer(vPadding1))
87+ let width = max(minWidth - 2 * padding.x, userView.frame.width)
87 let photoView = CollectionView()
90 let photoView = CollectionView()
88 photoView.alignment = .top
91 photoView.alignment = .top
89 photoView.horizontalPadding = 8
92 photoView.horizontalPadding = 8
90 photoView.verticalPadding = 8
93 photoView.verticalPadding = 8
91 photoView.padding = CGPoint.zero
94 photoView.padding = CGPoint.zero
95+ photoView.maxWidth = width
92 var maxPhotoDim: CGFloat = 150
96 var maxPhotoDim: CGFloat = 150
93 if let attachments = post?.attachments {
97 if let attachments = post?.attachments {
94 for attachment in attachments {
98 for attachment in attachments {
@@ -98,6 +102,7 @@ class CardView: UIView {
98 if var pWidth = photo.width.value >>> {CGFloat($0)},
102 if var pWidth = photo.width.value >>> {CGFloat($0)},
99 var pHeight = photo.height.value >>> {CGFloat($0)} {
103 var pHeight = photo.height.value >>> {CGFloat($0)} {
100 let photoV = UIImageView()
104 let photoV = UIImageView()
105+ photoV.layer.minificationFilter = kCAFilterTrilinear
101 photo.image?.load(into: photoV)
106 photo.image?.load(into: photoV)
102 var k: CGFloat!
107 var k: CGFloat!
103 if pWidth > pHeight {
108 if pWidth > pHeight {
@@ -123,7 +128,7 @@ class CardView: UIView {
123 textHeight -= padding.y + vPadding1 + userView.frame.height
128 textHeight -= padding.y + vPadding1 + userView.frame.height
124 if let count = post?.attachments.count{
129 if let count = post?.attachments.count{
125 if count > 0 {
130 if count > 0 {
126− textHeight -= vPadding2 + photoView.frame.height
131+ textHeight -= vPadding2 + photoView.frame.height + padding.y
129 print(textHeight)
134 print(textHeight)
@@ -132,7 +137,7 @@ class CardView: UIView {
133 let body = UILabel()
138 let body = UILabel()
134 body.numberOfLines = 0
139 body.numberOfLines = 0
135− let bodyWidth: Double = Double(width - padding.x * 2)
140+ let bodyWidth: Double = Double(width)
136 body.font = UIFont.systemFont(ofSize: 22, weight: UIFontWeightSemibold)
141 body.font = UIFont.systemFont(ofSize: 22, weight: UIFontWeightSemibold)
137 body.text = post?.body
142 body.text = post?.body
138 let size = body.textRect(forBounds: CGRect(x: 0, y: 0, width: bodyWidth, height: Double.infinity), limitedToNumberOfLines: 0).size
143 let size = body.textRect(forBounds: CGRect(x: 0, y: 0, width: bodyWidth, height: Double.infinity), limitedToNumberOfLines: 0).size
@@ -148,7 +153,7 @@ class CardView: UIView {
151− frame.size = CGSize(width: width, height: height)
156+ frame.size = CGSize(width: width + padding.x * 2, height: height)