Commit 5e1ada94 authored by Zandor Smith's avatar Zandor Smith 💻

Add function to generate a UISwitchTableViewCell.

parent a8019ec1
......@@ -9,6 +9,17 @@ import UIKit
public class UISwitchTableViewCell: UITableViewCell {
public static let identifier: String = "UISwitchTableViewCell"
public static func generateReusableCell(for tableView: UITableView) -> UISwitchTableViewCell {
var cell = tableView.dequeueReusableCell(withIdentifier: UISwitchTableViewCell.identifier) as? UISwitchTableViewCell
if cell == nil {
tableView.register(UINib(nibName: UISwitchTableViewCell.identifier, bundle: nil), forCellReuseIdentifier: UISwitchTableViewCell.identifier)
cell = tableView.dequeueReusableCell(withIdentifier: UISwitchTableViewCell.identifier) as? UISwitchTableViewCell
}
return cell!
}
var callback: (Bool) -> Void = { state in }
let theSwitch = UISwitch()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment