X-Git-Url: https://git.mdrn.pl/wl-app.git/blobdiff_plain/53b27422d140022594fc241cca91c3183be57bca..48b2fe9f7c2dc3d9aeaaa6dbfb27c7da4f3235ff:/iOS/WolneLektury/Screens/Common/Cells/WLTableViewCell.swift?ds=inline diff --git a/iOS/WolneLektury/Screens/Common/Cells/WLTableViewCell.swift b/iOS/WolneLektury/Screens/Common/Cells/WLTableViewCell.swift new file mode 100644 index 0000000..68bd973 --- /dev/null +++ b/iOS/WolneLektury/Screens/Common/Cells/WLTableViewCell.swift @@ -0,0 +1,54 @@ +// +// WLTableViewCell.swift +// WolneLektury +// +// Created by Pawel Dabrowski on 30/05/2018. +// Copyright © 2018 Fundacja Nowoczesna Polska. All rights reserved. +// + +import UIKit + +class WLTableViewCell: UITableViewCell { + + override func awakeFromNib() { + super.awakeFromNib() + selectionStyle = .none + } + + override func setSelected(_ selected: Bool, animated: Bool) { + super.setSelected(selected, animated: animated) + + // Configure the view for the selected state + } + + static var fullNameIdentifier: String { + var fullName: String = NSStringFromClass(self) + let range = fullName.range(of: ".", options: .backwards) + if let range = range { + fullName = fullName.substring(from: range.upperBound) + } + return fullName + } + + static var reuseIdentifier: String { + return fullNameIdentifier + } + + class func instance(type: T.Type) -> T{ + let cell = Bundle.main.loadNibNamed(fullNameIdentifier, owner: nil, options: nil)!.first as! T + return cell + } + + static var nib: UINib? { + if((Bundle.main.path(forResource: fullNameIdentifier, ofType: "nib")) != nil) + { + return UINib(nibName: String(fullNameIdentifier), bundle: nil) + } + return nil + } + + func getHeight() -> CGFloat { + return UITableViewAutomaticDimension + } + +}