This file contains hidden or 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
| extension UITableView { | |
| func register<T: UITableViewCell>(_ cellClass: T.Type) { | |
| register(T.self, forCellReuseIdentifier: String(describing: T.self)) | |
| } | |
| func reusableCell<T: UITableViewCell>(for indexPath: IndexPath) -> T { | |
| // swiftlint:disable force_cast | |
| dequeueReusableCell(withIdentifier: String(describing: T.self), for: indexPath) as! T | |
| } | |
This file contains hidden or 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
| extension Double { | |
| func formattedAsCurrency(_ currencySymbol: String? = nil) -> String { | |
| let formatter = NumberFormatter() | |
| formatter.numberStyle = .currency | |
| formatter.locale = Locale(identifier: "id_ID") | |
| if let currencySymbol { | |
| formatter.currencySymbol = currencySymbol | |
| } | |
| let price = NSNumber(value: self) |
This file contains hidden or 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
| protocol Instantiatable { | |
| static var storyboard: Storyboard { get } | |
| static func instantiate() -> Self | |
| } | |
| extension Instantiatable where Self: UIViewController { | |
| static func instantiate() -> Self { | |
| // swiftlint:disable force_cast | |
| UIStoryboard(storyboard).instantiateViewController(withIdentifier: String(describing: Self.self)) as! Self | |
| } |
OlderNewer