-
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
Extract reward cell to its own nib #88
Conversation
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.
cool, nice and clean
@@ -28,6 +28,9 @@ public final class ProjectPamphletContentViewController: UITableViewController { | |||
self, action: #selector(scrollViewPanGestureRecognizerDidChange(_:)) | |||
) | |||
|
|||
self.tableView.register(UINib(nibName: "RewardCell", bundle: Bundle.framework), | |||
forCellReuseIdentifier: "RewardCell") |
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.
might be nice to put this in a new enum in Storyboard.swift
?
extension UITableView { | ||
public func register(nib: Nib, inBundle bundle: Bundle = .framework) { | ||
self.register(UINib(nibName: nib.rawValue, bundle: bundle), forCellReuseIdentifier: nib.rawValue) | ||
} |
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.
nice nice!
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.
great suggestion!
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.
you know how much i love enums
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 looking at this going cool but where are the rest of the changes??
Nice! Glad it's so simple. Cell's having their own view models certainly makes this easier too.
Been tinkering with how we can reuse table view cells across multiple controllers/storyboards, and turns out it's very easy. So, I took a shot at doing this for our
RewardCell
, which is definitely our most complicated cell. I did this one cause some future work is gonna bring rewards into some new views.To do this I literally just cut+pasted the cell from the storyboard to a brand new
*.xib
file. Then I have to do an explicitself.tableView.register(nib)
step in the controller because that's what the storyboard + prototype cell does for you. But after that it just worked!