Skip to content
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

Merged
merged 5 commits into from
Dec 11, 2017
Merged

Conversation

SD10
Copy link
Member

@SD10 SD10 commented Dec 9, 2017

Summary:

Removes generic constraints on MessageCollectionViewCell<ContentView: UIView>

Everything is subject to change, really just want to be able to see the GitHub diff 😅

@SD10 SD10 force-pushed the enhancement/remove-cells branch from 11da98c to 14d8747 Compare December 9, 2017 03:08
// view.alpha = 1.0
// }, completion: nil)
// }
// }
Copy link
Member

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?

Copy link
Member Author

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
Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting switch statement 😝


playButtonView.translatesAutoresizingMaskIntoConstraints = false
playButtonView.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
playButtonView.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
Copy link
Member

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
Copy link
Member

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

Copy link
Member Author

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

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
Copy link
Member

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

@SD10 SD10 force-pushed the enhancement/remove-cells branch from 4d843c1 to 691359c Compare December 9, 2017 13:10
@SD10
Copy link
Member Author

SD10 commented Dec 9, 2017

Just looking at the diff for the PR shows it wasn't worth the trouble to make it generic in the first place

@SD10 SD10 changed the title Removing all the cell subclasses and generic constraints Removing cell generic constraints Dec 9, 2017
SD10 added a commit that referenced this pull request Dec 10, 2017
@SD10 SD10 force-pushed the enhancement/remove-cells branch from 37c463a to d928803 Compare December 10, 2017 07:47
super.init(frame: frame)
contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
Copy link
Member

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.

Copy link
Member Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use default size?

@SD10 SD10 merged commit 0af6454 into development Dec 11, 2017
@SD10 SD10 deleted the enhancement/remove-cells branch December 11, 2017 19:38
@SD10 SD10 removed the under review label Dec 11, 2017
@SD10 SD10 mentioned this pull request Dec 18, 2017
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants