diff --git a/OpenSourceController/Classes/Controller/OpenSourceViewController.swift b/OpenSourceController/Classes/Controller/OpenSourceViewController.swift index d0d7b74..52e4075 100644 --- a/OpenSourceController/Classes/Controller/OpenSourceViewController.swift +++ b/OpenSourceController/Classes/Controller/OpenSourceViewController.swift @@ -76,18 +76,24 @@ class OpenSourceViewController: UITableViewController { self.tableView.dataSource = self self.tableView.delegate = self self.tableView.separatorStyle = .singleLine - self.tableView.backgroundColor = config.uiConfig.backgroundColor + if let backgroundColor = self.config.uiConfig.backgroundColor { + self.tableView.backgroundColor = backgroundColor + } // Navigation bar - self.navigationController?.navigationBar.barTintColor = self.config.uiConfig.barTintColor - let attribut = [NSForegroundColorAttributeName: self.config.uiConfig.titleColor] - self.navigationController?.navigationBar.titleTextAttributes = attribut + if let tintColor = self.config.uiConfig.barTintColor { + self.navigationController?.navigationBar.barTintColor = tintColor + } + if let textColor = self.config.uiConfig.titleColor { + let attribut = [NSForegroundColorAttributeName: textColor] + self.navigationController?.navigationBar.titleTextAttributes = attribut + } // Close button (on the right corner of navigation bar) let closeButton = UIBarButtonItem(barButtonSystemItem: .stop, target: self, action: #selector(self.closePicker)) - closeButton.tintColor = config.uiConfig.closeButtonColor + closeButton.tintColor = config.uiConfig.closeButtonColor ?? UIColor.black self.navigationItem.rightBarButtonItem = closeButton // Loading indicator diff --git a/OpenSourceController/Classes/Model/OpenSourceControllerConfig.swift b/OpenSourceController/Classes/Model/OpenSourceControllerConfig.swift index 394fbcb..e4552f0 100644 --- a/OpenSourceController/Classes/Model/OpenSourceControllerConfig.swift +++ b/OpenSourceController/Classes/Model/OpenSourceControllerConfig.swift @@ -12,22 +12,22 @@ public struct OpenSourceControllerConfig { /// Sub-stuct holding configuration relevant to UI presentation ! public struct UIConfig { /// Will be applied to the navigation bar - public var barTintColor: UIColor = UIColor(red: 246/255.0, green: 246/255.0, blue: 246/255.0, alpha: 1.0) + public var barTintColor: UIColor? /// Will be applied to the navigation bar - public var backgroundColor: UIColor = UIColor(red: 246/255.0, green: 246/255.0, blue: 246/255.0, alpha: 1.0) + public var backgroundColor: UIColor? /// Will be applied to licence text - public var licenceBackgroundColor: UIColor = UIColor.white + public var licenceBackgroundColor: UIColor? /// Will be applied to the navigation bar - public var closeButtonColor: UIColor = UIColor.black + public var closeButtonColor: UIColor? /// Will be applied to licence text - public var licenceTextColor: UIColor = UIColor.black + public var licenceTextColor: UIColor? /// Will be applied to licence text - public var titleColor: UIColor = UIColor.black + public var titleColor: UIColor? } /// Will be applied to the navigation bar title diff --git a/OpenSourceController/Classes/View/OpenSourceTableViewCell.swift b/OpenSourceController/Classes/View/OpenSourceTableViewCell.swift index 9be19c2..0694dfe 100644 --- a/OpenSourceController/Classes/View/OpenSourceTableViewCell.swift +++ b/OpenSourceController/Classes/View/OpenSourceTableViewCell.swift @@ -64,6 +64,8 @@ class OpenSourceTableViewCell: UITableViewCell { self.textLabel?.textColor = config.uiConfig.licenceTextColor // Background - self.backgroundColor = config.uiConfig.licenceBackgroundColor + if let backgroundColor = config.uiConfig.licenceBackgroundColor { + self.backgroundColor = backgroundColor + } } }