fix code review notes
This commit is contained in:
parent
102c15ca07
commit
2e84f5cb2d
|
|
@ -69,7 +69,7 @@ open class StatefulButton: UIButton {
|
|||
|
||||
public var onDisabledStateTapHandler: VoidClosure?
|
||||
|
||||
var eventPropagations: StateEventPropagations = [:]
|
||||
private var eventPropagations: StateEventPropagations = [:]
|
||||
|
||||
// MARK: - Background
|
||||
|
||||
|
|
@ -182,6 +182,8 @@ open class StatefulButton: UIButton {
|
|||
at: position))
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func constraints(for activityIndicator: ActivityIndicator,
|
||||
at position: ActivityIndicatorPosition) -> [NSLayoutConstraint] {
|
||||
switch position {
|
||||
|
|
@ -205,8 +207,6 @@ open class StatefulButton: UIButton {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func updateBackgroundColor() {
|
||||
if isEnabled {
|
||||
if isHighlighted {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ import CoreGraphics
|
|||
import CoreText
|
||||
import Foundation
|
||||
|
||||
public enum FontFormat: String {
|
||||
case woff2
|
||||
}
|
||||
|
||||
public extension CTFont {
|
||||
enum FontRegistrationError: Error {
|
||||
case fontsNotFound
|
||||
|
|
@ -56,8 +60,11 @@ public extension CTFont {
|
|||
}
|
||||
}
|
||||
|
||||
static func registerAllFonts(in bundle: Bundle) throws {
|
||||
guard let fontUrls = bundle.urls(forResourcesWithExtension: "woff2", subdirectory: nil),
|
||||
static func registerAllFonts(in bundle: Bundle,
|
||||
withFileExtension fileExtension: String = FontFormat.woff2.rawValue) throws {
|
||||
|
||||
guard let fontUrls = bundle.urls(forResourcesWithExtension: fileExtension,
|
||||
subdirectory: nil),
|
||||
!fontUrls.isEmpty else {
|
||||
throw FontRegistrationError.fontsNotFound
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,15 +26,10 @@ import UIKit.UIColor
|
|||
/// Base set of attributes to configure appearance of text.
|
||||
open class BaseTextAttributes {
|
||||
|
||||
/// Text font.
|
||||
public let font: UIFont
|
||||
/// Text color.
|
||||
public let color: UIColor
|
||||
/// Text alignment.
|
||||
public let alignment: NSTextAlignment
|
||||
/// Paragraph line height.
|
||||
public let lineHeightMultiple: CGFloat
|
||||
/// Number of lines for labels.
|
||||
public let numberOfLines: Int
|
||||
|
||||
public init(font: UIFont,
|
||||
|
|
@ -42,6 +37,7 @@ open class BaseTextAttributes {
|
|||
alignment: NSTextAlignment,
|
||||
lineHeightMultiple: CGFloat,
|
||||
numberOfLines: Int) {
|
||||
|
||||
self.font = font
|
||||
self.color = color
|
||||
self.alignment = alignment
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ extension UILabel: BaseTextAttributesConfigurable {
|
|||
}
|
||||
|
||||
public func set(color: UIColor) {
|
||||
self.textColor = color
|
||||
textColor = color
|
||||
}
|
||||
|
||||
public func set(alignment: NSTextAlignment) {
|
||||
self.textAlignment = alignment
|
||||
textAlignment = alignment
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -48,10 +48,10 @@ extension UITextField: BaseTextAttributesConfigurable {
|
|||
}
|
||||
|
||||
public func set(color: UIColor) {
|
||||
self.textColor = color
|
||||
textColor = color
|
||||
}
|
||||
|
||||
public func set(alignment: NSTextAlignment) {
|
||||
self.textAlignment = alignment
|
||||
textAlignment = alignment
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue