Last active
April 21, 2021 23:21
-
-
Save mhijack/c2d62d001ee06da012b274a11b42801c 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
class EmptyTableView: UITableView { | |
var emptyDataSource: EmptyTableViewDataSource | |
var emptyTableViewDelegate: EmptyTableViewDelegate? | |
var normalDataSource: UITableViewDataSource | |
var normalTableViewDelegate: UITableViewDelegate? | |
/// If we don't pass in empty and normal data source, this table view can be used as a regular table view. | |
init(emptyDataSource: EmptyTableViewDataSource, | |
normalDataSource: UITableViewDataSource, | |
emptyTableViewDelegate: EmptyTableViewDelegate? = nil, | |
normalTableViewDelegate: UITableViewDelegate? = nil) { | |
self.emptyDataSource = emptyDataSource | |
self.normalDataSource = normalDataSource | |
self.emptyTableViewDelegate = emptyTableViewDelegate | |
self.normalTableViewDelegate = normalTableViewDelegate | |
super.init(frame: .zero, style: .plain) | |
dataSource = normalDataSource | |
delegate = normalTableViewDelegate | |
} | |
required init?(coder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment