-
Notifications
You must be signed in to change notification settings - Fork 234
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
NibReusable -> Reusable & NibLoadable #37
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ import Reusable | |
* Which in fact is just a convenience protocol that combines | ||
* both `NibLoadable` + `Reusable` protocols. | ||
*/ | ||
final class MyXIBIndexSquaceCell: UICollectionViewCell, NibReusable { | ||
final class MyXIBIndexSquaceCell: UICollectionViewCell, Reusable, NibLoadable { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that we've decided to keep btw, you might also want to check the doc-comments throughout the code and sample project where we describe |
||
@IBOutlet private weak var sectionLabel: UILabel! | ||
@IBOutlet private weak var rowLabel: UILabel! | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ This concept, called a [Mixin](http://alisoftware.github.io/swift/protocol/2015/ | |
## 1. Declare your cells to conform to `Reusable` or `NibReusable` | ||
|
||
* Use the `Reusable` protocol if they don't depend on a NIB (this will use `registerClass(…)` to register the cell) | ||
* Use the `NibReusable` protocol if they use a `XIB` file for their content (this will use `registerNib(…)` to register the cell) | ||
* Use the `NibReusable` protocol (aka combination of `Reusable` & `NibLoadable` protocols) if they use a `XIB` file for their content (this will use `registerNib(…)` to register the cell) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the |
||
|
||
```swift | ||
final class CustomCell: UITableViewCell, Reusable { /* And that's it! */ } | ||
|
@@ -55,6 +55,7 @@ final class CustomCell: UITableViewCell, Reusable { /* And that's it! */ } | |
> | ||
> * For cells embedded in a Storyboard's tableView, either one of those two protocols will work (as you won't register the cell them manually anyway) | ||
> * If you create a XIB-based cell, don't forget to set its _Reuse Identifier_ field in Interface Builder to the same string as the name of the cell class itself. | ||
> * 💡 `NibReusable` is syntax sugar, so you could still use two protocols conformance `Reusable, NibLoadable` instead of `NibReusable`. | ||
|
||
|
||
<details> | ||
|
@@ -77,6 +78,9 @@ final class CodeBasedCustomCell: UITableViewCell, Reusable { | |
|
||
```swift | ||
final class NibBasedCustomCell: UITableViewCell, NibReusable { | ||
// or | ||
// final class NibBasedCustomCell: UITableViewCell, Reusable, NibLoadable { | ||
|
||
// Here we provide a nib for this cell class (which, if we don't override the protocol's | ||
// default implementation of `nib`, will use a XIB of the same name as the class) | ||
|
||
|
@@ -106,7 +110,11 @@ final class CodeBasedCollectionViewCell: UICollectionViewCell, Reusable { | |
// A UICollectionViewCell using a XIB to define it's UI | ||
// And that will need to register using that XIB | ||
final class NibBasedCollectionViewCell: UICollectionViewCell, NibReusable { | ||
// or | ||
// final class NibBasedCollectionViewCell: UICollectionViewCell, Reusable, NibLoadable { | ||
|
||
// The rest of the cell code goes here | ||
|
||
} | ||
``` | ||
</details> | ||
|
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.
Please add 2 spaces after your full-stop here (see other entries for inspiration).
Ending a line with two spaces in Markdown allows to go to the next line in the same paragraph (like a
<br>
) in the rendered document.The typical formatting I use in the CHANGELOG is this, where
•
represent a space: