Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Commit 5e49ae0

Browse files
committed
Add SwiftDoc for UITableView
1 parent 59b9b54 commit 5e49ae0

File tree

1 file changed

+45
-4
lines changed

1 file changed

+45
-4
lines changed

Library/UIKit/UITableView+ReuseIdentifierProtocol.swift

+45-4
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,68 @@ import Foundation
1010
import UIKit
1111

1212
public extension UITableView {
13+
/**
14+
Returns a typed reusable table-view cell object for the specified reuse identifier and adds it to the table.
15+
16+
- parameter identifier: A R.reuseIdentifier.* value identifying the cell object to be reused.
17+
- parameter indexPath: The index path specifying the location of the cell. The data source receives this information when it is asked for the cell and should just pass it along. This method uses the index path to perform additional configuration based on the cell’s position in the table view.
18+
19+
- returns: The UITableViewCell subclass with the associated reuse identifier or nil if it couldn't be casted correctly.
20+
21+
- precondition: You must register a class or nib file using the registerNib: or registerClass:forCellReuseIdentifier: method before calling this method.
22+
*/
1323
public func dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierProtocol where Identifier.ReusableType: UITableViewCell>(identifier: Identifier, forIndexPath indexPath: NSIndexPath) -> Identifier.ReusableType? {
1424
return dequeueReusableCellWithIdentifier(identifier.identifier, forIndexPath: indexPath) as? Identifier.ReusableType
1525
}
1626

27+
/**
28+
Returns a typed reusable table-view cell object for the specified reuse identifier and adds it to the table.
29+
30+
- parameter identifier: A R.reuseIdentifier.* value identifying the cell object to be reused.
31+
32+
- returns: The UITableViewCell subclass with the associated reuse identifier or nil if it couldn't be casted correctly.
33+
34+
- precondition: You must register a class or nib file using the registerNib: or registerClass:forCellReuseIdentifier: method before calling this method.
35+
*/
1736
public func dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierProtocol where Identifier.ReusableType: UITableViewCell>(identifier: Identifier) -> Identifier.ReusableType? {
1837
return dequeueReusableCellWithIdentifier(identifier.identifier) as? Identifier.ReusableType
1938
}
2039

40+
/**
41+
Returns a typed reusable header or footer view located by its identifier.
42+
43+
- parameter identifier: A R.reuseIdentifier.* value identifying the header or footer view to be reused.
44+
45+
- returns: A UITableViewHeaderFooterView object with the associated identifier or nil if no such object exists in the reusable view queue or if it couldn't be cast correctly.
46+
*/
2147
public func dequeueReusableHeaderFooterViewWithIdentifier<Identifier: ReuseIdentifierProtocol where Identifier.ReusableType: UITableViewCell>(identifier: Identifier) -> Identifier.ReusableType? {
2248
return dequeueReusableHeaderFooterViewWithIdentifier(identifier.identifier) as? Identifier.ReusableType
2349
}
2450

51+
/**
52+
Register an array of R.nib.*, each containing a cell, with the table view under it's contained identifier.
53+
54+
- parameter nibResources: Array of nib resources (R.nib.*) each containing a table view cell that has a reuse identifier
55+
*/
56+
public func registerNibs<Resource: NibResource where Resource: ReuseIdentifierProtocol, Resource.ReusableType: UITableViewCell>(nibResources: [Resource]) {
57+
nibResources.forEach(registerNib)
58+
}
59+
60+
/**
61+
Register a R.nib.* containing a cell with the table view under it's contained identifier.
62+
63+
- parameter nibResource: A nib resource (R.nib.*) containing a table view cell that has a reuse identifier
64+
*/
2565
public func registerNib<Resource: NibResource where Resource: ReuseIdentifierProtocol, Resource.ReusableType: UITableViewCell>(nibResource: Resource) {
2666
registerNib(nibResource.instance, forCellReuseIdentifier: nibResource.identifier)
2767
}
2868

69+
/**
70+
Register a R.nib.* containing a header or footer with the table view under it's contained identifier.
71+
72+
- parameter nibResource: A nib resource (R.nib.*) containing a view that has a reuse identifier
73+
*/
2974
public func registerNibForHeaderFooterView<Resource: NibResource where Resource: ReuseIdentifierProtocol, Resource.ReusableType: UIView>(nibResource: Resource) {
3075
registerNib(nibResource.instance, forHeaderFooterViewReuseIdentifier: nibResource.identifier)
3176
}
32-
33-
public func registerNibs<Resource: NibResource where Resource: ReuseIdentifierProtocol, Resource.ReusableType: UITableViewCell>(nibResources: [Resource]) {
34-
nibResources.forEach(registerNib)
35-
}
3677
}

0 commit comments

Comments
 (0)