Commit f47bdadf by Orkhan Alikhanov

Added missing comments

parent c7f75ba0
......@@ -171,6 +171,10 @@ open class BottomNavigationController: UITabBarController, Themeable {
applyCurrentTheme()
}
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) {
tabBar.tintColor = theme.secondary
tabBar.barTintColor = theme.background
......
......@@ -285,7 +285,7 @@ open class Button: UIButton, Pulseable, PulseableLayer, Themeable {
}
/**
Applies given theme to the view.
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) { }
......
......@@ -190,6 +190,10 @@ open class Editor: View, Themeable {
layoutBottomLabel(label: detailLabel, verticalOffset: detailVerticalOffset)
}
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) {
placeholderActiveColor = theme.secondary
placeholderNormalColor = theme.onSurface.withAlphaComponent(0.38)
......
......@@ -99,7 +99,11 @@ internal extension UIColor {
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 {
var h: CGFloat = 0
var s: CGFloat = 0
......@@ -111,11 +115,13 @@ internal extension UIColor {
return UIColor(hue: h, saturation: s, brightness: (b + value).clamp(0, 1), alpha: 1)
}
/// A lighter version of the color.
var lighter: UIColor {
return adjustingBrightness(by: 0.05)
return adjustingBrightness(by: 0.1)
}
/// A darker version of the color.
var darker: UIColor {
return adjustingBrightness(by: -0.05)
return adjustingBrightness(by: -0.1)
}
}
......@@ -171,6 +171,10 @@ open class NavigationBar: UINavigationBar, Themeable {
applyCurrentTheme()
}
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) {
backgroundColor = theme.primary
items?.forEach {
......@@ -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) {
Theme.apply(theme: theme, to: item.toolbar)
item.toolbar.backgroundColor = .clear
......
......@@ -327,6 +327,10 @@ open class Switch: UIControl, Themeable {
applyCurrentTheme()
}
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) {
buttonOnColor = theme.secondary
trackOnColor = theme.secondary.withAlphaComponent(0.60)
......
......@@ -462,6 +462,10 @@ open class TextField: UITextField, Themeable {
applyCurrentTheme()
}
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) {
placeholderActiveColor = theme.secondary
placeholderNormalColor = theme.onSurface.withAlphaComponent(0.38)
......
......@@ -356,6 +356,10 @@ open class TextView: UITextView, Themeable {
fixTypingFont()
}
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) {
textColor = theme.onSurface.withAlphaComponent(0.87)
placeholderColor = theme.onSurface.withAlphaComponent(0.38)
......
......@@ -147,6 +147,10 @@ open class Toolbar: Bar, Themeable {
prepareDetailLabel()
}
/**
Applies the given theme.
- Parameter theme: A Theme.
*/
open func apply(theme: Theme) {
backgroundColor = theme.primary
(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