Skip to content

Commit

Permalink
fixed nib registration for custom cell identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
mbuchetics committed Nov 8, 2017
1 parent 3f32f84 commit b6b5544
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DataSource/DataSource+UITableViewDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extension DataSource: UITableViewDataSource {
let cellIdentifier = cellDescriptor.cellIdentifier

if registerNibs && !reuseIdentifiers.contains(cellIdentifier) && Bundle.main.path(forResource: cellIdentifier, ofType: "nib") != nil {
tableView.registerNib(cellDescriptor.cellClass)
tableView.registerNib(cellIdentifier)
reuseIdentifiers.insert(cellIdentifier)
}

Expand Down
2 changes: 1 addition & 1 deletion DataSource/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.0</string>
<string>5.0.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
5 changes: 4 additions & 1 deletion DataSource/UITableViewExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ struct Batch {
extension UITableView {

public func registerNib(_ cellType: UITableViewCell.Type) {
let cellIdentifier = String(describing: cellType)
registerNib(String(describing: cellType))
}

public func registerNib(_ cellIdentifier: String) {
register(UINib(nibName: cellIdentifier, bundle: nil), forCellReuseIdentifier: cellIdentifier)
}

Expand Down
2 changes: 1 addition & 1 deletion Example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.0</string>
<string>5.0.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down

0 comments on commit b6b5544

Please sign in to comment.