Created
January 13, 2019 20:32
-
-
Save Hadevs/b7f3fdd804dfe78f3d4b36fec3110c66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ProVersionConstructor: NSObject, StaticConstructorContainer { | |
var models: [ProVersionConstructor.ModelType] = [ | |
.logo, .advantagesHeader, .instabilityText, .proVersionHeader, .exampleText, .empty, .upgradeButton | |
] | |
typealias ModelType = ProVersionCellModel | |
func cellType(for model: ProVersionCellModel) -> StaticTableViewCellClass.Type { | |
switch model { | |
case .logo: return ImageTableViewCell.self | |
case .advantagesHeader, .proVersionHeader: return TextTableViewCell.self | |
case .instabilityText, .exampleText: return TextViewTableViewCell.self | |
case .upgradeButton: return ButtonTableViewCell.self | |
case .empty: return EmptyTableViewCell.self | |
} | |
} | |
func configure(cell: UITableViewCell, by model: ProVersionCellModel) { | |
switch model { | |
case .proVersionHeader: | |
cell.backgroundColor = .clear | |
cell.separatorInset = .zero | |
case .exampleText: | |
cell.backgroundColor = .clear | |
cell.separatorInset = .goAway | |
case .advantagesHeader: | |
cell.separatorInset = .goAway | |
case .empty: | |
cell.backgroundColor = .clear | |
default: break | |
} | |
if let typedCell = cell as? TextTableViewCell { | |
typedCell.label.textColor = CRColor.Chats.Cell.title | |
} | |
if let typedCell = cell as? TextViewTableViewCell { | |
typedCell.textView.textColor = CRColor.Chats.Cell.title | |
} | |
} | |
func itemSelected(item: ProVersionCellModel) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment