<commit_before>//
//  UITableView+ReuseIdentifierProtocol.swift
//  R.swift Library
//
//  Created by <NAME> on 06-12-15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import Foundation
import UIKit

public extension UITableView {
  /**
   Returns a typed reusable table-view cell object for the specified reuse identifier and adds it to the table.
   
   - parameter identifier: A R.reuseIdentifier.* value identifying the cell object to be reused.
   - 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.
   
   - returns: The UITableViewCell subclass with the associated reuse identifier or nil if it couldn't be casted correctly.
   
   - precondition: You must register a class or nib file using the registerNib: or registerClass:forCellReuseIdentifier: method before calling this method.
  */
  public func dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(identifier: Identifier, forIndexPath indexPath: NSIndexPath) -> Identifier.ReusableType? {
    return dequeueReusableCellWithIdentifier(identifier.identifier, forIndexPath: indexPath) as? Identifier.ReusableType
  }

  /**
   Returns a typed reusable table-view cell object for the specified reuse identifier and adds it to the table.

   - parameter identifier: A R.reuseIdentifier.* value identifying the cell object to be reused.

   - returns: The UITableViewCell subclass with the associated reuse identifier or nil if it couldn't be casted correctly.

   - precondition: You must register a class or nib file using the registerNib: or registerClass:forCellReuseIdentifier: method before calling this method.
   */
  public func dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(identifier: Identifier) -> Identifier.ReusableType? {
    return dequeueReusableCellWithIdentifier(identifier.identifier) as? Identifier.ReusableType
  }

  /**
   Returns a typed reusable header or footer view located by its identifier.
   
   - parameter identifier: A R.reuseIdentifier.* value identifying the header or footer view to be reused.
   
   - 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.
   */
  public func dequeueReusableHeaderFooterViewWithIdentifier<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(identifier: Identifier) -> Identifier.ReusableType? {
    return dequeueReusableHeaderFooterViewWithIdentifier(identifier.identifier) as? Identifier.ReusableType
  }

  /**
   Register an array of R.nib.*, each containing a cell, with the table view under it's contained identifier.

   - parameter nibResources: Array of nib resources (R.nib.*) each containing a table view cell that has a reuse identifier
   */
  public func registerNibs<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell>(nibResources: [Resource]) {
    nibResources.forEach(registerNib)
  }

  /**
   Register a R.nib.* containing a cell with the table view under it's contained identifier.
   
   - parameter nibResource: A nib resource (R.nib.*) containing a table view cell that has a reuse identifier
  */
  public func registerNib<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell>(nibResource: Resource) {
    registerNib(UINib(resource: nibResource), forCellReuseIdentifier: nibResource.identifier)
  }

  /**
   Register a R.nib.* containing a header or footer with the table view under it's contained identifier.

   - parameter nibResource: A nib resource (R.nib.*) containing a view that has a reuse identifier
   */
  public func registerNibForHeaderFooterView<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UIView>(nibResource: Resource) {
    registerNib(UINib(resource: nibResource), forHeaderFooterViewReuseIdentifier: nibResource.identifier)<commit_msg>Fix typo that causes views of the correct superclass to not be dequeued as UITableView header/footer views<commit_after>//
//  UITableView+ReuseIdentifierProtocol.swift
//  R.swift Library
//
//  Created by <NAME> on 06-12-15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import Foundation
import UIKit

public extension UITableView {
  /**
   Returns a typed reusable table-view cell object for the specified reuse identifier and adds it to the table.
   
   - parameter identifier: A R.reuseIdentifier.* value identifying the cell object to be reused.
   - 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.
   
   - returns: The UITableViewCell subclass with the associated reuse identifier or nil if it couldn't be casted correctly.
   
   - precondition: You must register a class or nib file using the registerNib: or registerClass:forCellReuseIdentifier: method before calling this method.
  */
  public func dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(identifier: Identifier, forIndexPath indexPath: NSIndexPath) -> Identifier.ReusableType? {
    return dequeueReusableCellWithIdentifier(identifier.identifier, forIndexPath: indexPath) as? Identifier.ReusableType
  }

  /**
   Returns a typed reusable table-view cell object for the specified reuse identifier and adds it to the table.

   - parameter identifier: A R.reuseIdentifier.* value identifying the cell object to be reused.

   - returns: The UITableViewCell subclass with the associated reuse identifier or nil if it couldn't be casted correctly.

   - precondition: You must register a class or nib file using the registerNib: or registerClass:forCellReuseIdentifier: method before calling this method.
   */
  public func dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(identifier: Identifier) -> Identifier.ReusableType? {
    return dequeueReusableCellWithIdentifier(identifier.identifier) as? Identifier.ReusableType
  }

  /**
   Returns a typed reusable header or footer view located by its identifier.
   
   - parameter identifier: A R.reuseIdentifier.* value identifying the header or footer view to be reused.
   
   - 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.
   */
  public func dequeueReusableHeaderFooterViewWithIdentifier<Identifier: ReuseIdentifierType where Identifier.ReusableType: UIView>(identifier: Identifier) -> Identifier.ReusableType? {
    return dequeueReusableHeaderFooterViewWithIdentifier(identifier.identifier) as? Identifier.ReusableType
  }

  /**
   Register an array of R.nib.*, each containing a cell, with the table view under it's contained identifier.

   - parameter nibResources: Array of nib resources (R.nib.*) each containing a table view cell that has a reuse identifier
   */
  public func registerNibs<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell>(nibResources: [Resource]) {
    nibResources.forEach(registerNib)
  }

  /**
   Register a R.nib.* containing a cell with the table view under it's contained identifier.
   
   - parameter nibResource: A nib resource (R.nib.*) containing a table view cell that has a reuse identifier
  */
  public func registerNib<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell>(nibResource: Resource) {
    registerNib(UINib(resource: nibResource), forCellReuseIdentifier: nibResource.identifier)
  }

  /**
   Register a R.nib.* containing a header or footer with the table view under it's contained identifier.

   - parameter nibResource: A nib resource (R.nib.*) containing a view that has a reuse identifier
   */
  public func registerNibForHeaderFooterView<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UIView>(nibResource: Resource) {
    registerNib(UINib(resource: nibResource), forHeaderFooterViewReuseIdentifier: nibResource.identifier)
{'fraction_non_alphanumeric': 0.06229773462783172, 'fraction_numerical': 0.002311604253351826, 'mean_word_length': 4.700263504611331, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1213350', 'n_tokens_mistral': 2335, 'n_tokens_neox': 2145, 'n_words': 885}