-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing cell generic constraints #391
Conversation
11da98c
to
14d8747
Compare
// view.alpha = 1.0 | ||
// }, completion: nil) | ||
// } | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we want this commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure 😅 It's in progress. I don't think I'm going to be able to remove the subclasses. It doesn't make sense to support multi text messages to be honest. If anything far down the road we can have a subclass for urls/file previews that shows both an image and text
} | ||
|
||
open override func prepareForReuse() { | ||
cellTopLabel.text = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to call super here? idk if we do
|
||
let touchLocation = gesture.location(in: self) | ||
|
||
switch true { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting switch statement 😝
Sources/Views/MediaView.swift
Outdated
|
||
playButtonView.translatesAutoresizingMaskIntoConstraints = false | ||
playButtonView.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true | ||
playButtonView.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is off
contentView.topAnchor.constraint(equalTo: topAnchor).isActive = true | ||
contentView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true | ||
contentView.leftAnchor.constraint(equalTo: leftAnchor).isActive = true | ||
contentView.rightAnchor.constraint(equalTo: rightAnchor).isActive = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use NSLayoutConstraint.activate() its faster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, should've left a todo. did this for fast refactor
Sources/Views/MediaView.swift
Outdated
playButtonView.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true | ||
playButtonView.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true | ||
playButtonView.widthAnchor.constraint(equalToConstant: playButtonView.bounds.width).isActive = true | ||
playButtonView.heightAnchor.constraint(equalToConstant: playButtonView.bounds.height).isActive = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use NSLayoutConstraint.activate() its faster
4d843c1
to
691359c
Compare
Just looking at the diff for the PR shows it wasn't worth the trouble to make it generic in the first place |
37c463a
to
d928803
Compare
super.init(frame: frame) | ||
contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this autoresizingMask
necessary? Cell would manage contentView
's frame in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to keep it for now because I can't remember why it is here 😅 I think there may have been a small problem on rotation
@@ -66,7 +58,7 @@ open class LocationMessageCell: MessageCollectionViewCell<UIImageView> { | |||
|
|||
let snapshotOptions = MKMapSnapshotOptions() | |||
snapshotOptions.region = MKCoordinateRegion(center: location.coordinate, span: options.span) | |||
snapshotOptions.size = messageContainerView.frame.size | |||
//snapshotOptions.size = imageView.frame.size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use default size?
Summary:
Removes generic constraints on
MessageCollectionViewCell<ContentView: UIView>
Everything is subject to change, really just want to be able to see the GitHub diff 😅