Commit f47bdadf by Orkhan Alikhanov

Added missing comments

parent c7f75ba0
...@@ -171,6 +171,10 @@ open class BottomNavigationController: UITabBarController, Themeable { ...@@ -171,6 +171,10 @@ open class BottomNavigationController: UITabBarController, Themeable {
applyCurrentTheme() applyCurrentTheme()
} }
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) { open func apply(theme: Theme) {
tabBar.tintColor = theme.secondary tabBar.tintColor = theme.secondary
tabBar.barTintColor = theme.background tabBar.barTintColor = theme.background
......
...@@ -285,9 +285,9 @@ open class Button: UIButton, Pulseable, PulseableLayer, Themeable { ...@@ -285,9 +285,9 @@ open class Button: UIButton, Pulseable, PulseableLayer, Themeable {
} }
/** /**
Applies given theme to the view. Applies the given theme.
- Parameter theme: A Theme. - Parameter theme: A Theme.
*/ */
open func apply(theme: Theme) { } open func apply(theme: Theme) { }
} }
......
...@@ -190,6 +190,10 @@ open class Editor: View, Themeable { ...@@ -190,6 +190,10 @@ open class Editor: View, Themeable {
layoutBottomLabel(label: detailLabel, verticalOffset: detailVerticalOffset) layoutBottomLabel(label: detailLabel, verticalOffset: detailVerticalOffset)
} }
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) { open func apply(theme: Theme) {
placeholderActiveColor = theme.secondary placeholderActiveColor = theme.secondary
placeholderNormalColor = theme.onSurface.withAlphaComponent(0.38) placeholderNormalColor = theme.onSurface.withAlphaComponent(0.38)
......
...@@ -99,7 +99,11 @@ internal extension UIColor { ...@@ -99,7 +99,11 @@ internal extension UIColor {
return UIColor(red: newR, green: newG, blue: newB, alpha: newA) return UIColor(red: newR, green: newG, blue: newB, alpha: newA)
} }
/**
Adjusts brightness of the color by given value.
- Parameter by value: A CGFloat value.
- Returns: Adjusted color.
*/
func adjustingBrightness(by value: CGFloat) -> UIColor { func adjustingBrightness(by value: CGFloat) -> UIColor {
var h: CGFloat = 0 var h: CGFloat = 0
var s: CGFloat = 0 var s: CGFloat = 0
...@@ -111,11 +115,13 @@ internal extension UIColor { ...@@ -111,11 +115,13 @@ internal extension UIColor {
return UIColor(hue: h, saturation: s, brightness: (b + value).clamp(0, 1), alpha: 1) return UIColor(hue: h, saturation: s, brightness: (b + value).clamp(0, 1), alpha: 1)
} }
/// A lighter version of the color.
var lighter: UIColor { var lighter: UIColor {
return adjustingBrightness(by: 0.05) return adjustingBrightness(by: 0.1)
} }
/// A darker version of the color.
var darker: UIColor { var darker: UIColor {
return adjustingBrightness(by: -0.05) return adjustingBrightness(by: -0.1)
} }
} }
...@@ -171,6 +171,10 @@ open class NavigationBar: UINavigationBar, Themeable { ...@@ -171,6 +171,10 @@ open class NavigationBar: UINavigationBar, Themeable {
applyCurrentTheme() applyCurrentTheme()
} }
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) { open func apply(theme: Theme) {
backgroundColor = theme.primary backgroundColor = theme.primary
items?.forEach { items?.forEach {
...@@ -178,6 +182,11 @@ open class NavigationBar: UINavigationBar, Themeable { ...@@ -178,6 +182,11 @@ open class NavigationBar: UINavigationBar, Themeable {
} }
} }
/**
Applies the given theme to the navigation item.
- Parameter theme: A Theme.
- Parameter to item: A UINavigationItem.
*/
private func apply(theme: Theme, to item: UINavigationItem) { private func apply(theme: Theme, to item: UINavigationItem) {
Theme.apply(theme: theme, to: item.toolbar) Theme.apply(theme: theme, to: item.toolbar)
item.toolbar.backgroundColor = .clear item.toolbar.backgroundColor = .clear
......
...@@ -327,6 +327,10 @@ open class Switch: UIControl, Themeable { ...@@ -327,6 +327,10 @@ open class Switch: UIControl, Themeable {
applyCurrentTheme() applyCurrentTheme()
} }
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) { open func apply(theme: Theme) {
buttonOnColor = theme.secondary buttonOnColor = theme.secondary
trackOnColor = theme.secondary.withAlphaComponent(0.60) trackOnColor = theme.secondary.withAlphaComponent(0.60)
......
...@@ -462,6 +462,10 @@ open class TextField: UITextField, Themeable { ...@@ -462,6 +462,10 @@ open class TextField: UITextField, Themeable {
applyCurrentTheme() applyCurrentTheme()
} }
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) { open func apply(theme: Theme) {
placeholderActiveColor = theme.secondary placeholderActiveColor = theme.secondary
placeholderNormalColor = theme.onSurface.withAlphaComponent(0.38) placeholderNormalColor = theme.onSurface.withAlphaComponent(0.38)
......
...@@ -356,6 +356,10 @@ open class TextView: UITextView, Themeable { ...@@ -356,6 +356,10 @@ open class TextView: UITextView, Themeable {
fixTypingFont() fixTypingFont()
} }
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) { open func apply(theme: Theme) {
textColor = theme.onSurface.withAlphaComponent(0.87) textColor = theme.onSurface.withAlphaComponent(0.87)
placeholderColor = theme.onSurface.withAlphaComponent(0.38) placeholderColor = theme.onSurface.withAlphaComponent(0.38)
......
...@@ -147,6 +147,10 @@ open class Toolbar: Bar, Themeable { ...@@ -147,6 +147,10 @@ open class Toolbar: Bar, Themeable {
prepareDetailLabel() prepareDetailLabel()
} }
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) { open func apply(theme: Theme) {
backgroundColor = theme.primary backgroundColor = theme.primary
(leftViews + rightViews + centerViews).forEach { (leftViews + rightViews + centerViews).forEach {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment