Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-22 13:58:55 +01:00
parent 4af19165ec
commit 68073add76
12458 changed files with 12350765 additions and 2 deletions

View file

@ -0,0 +1,47 @@
extension UITextField {
@objc override func applyTheme() {
for style in StyleManager.shared.getStyle(styleName)
where !style.isEmpty && !style.hasExclusion(view: self) {
UITextFieldRenderer.render(self, style: style)
}
}
@objc override func sw_didMoveToWindow() {
guard MapsAppDelegate.theApp().window === window else {
sw_didMoveToWindow();
return
}
applyTheme()
isStyleApplied = true
sw_didMoveToWindow();
}
}
class UITextFieldRenderer {
class func render(_ control: UITextField, style: Style) {
if let cornerRadius = style.cornerRadius {
control.layer.setCornerRadius(cornerRadius)
control.clipsToBounds = true
}
control.borderStyle = .none
var placeholderAttributes = [NSAttributedString.Key : Any]()
if let backgroundColor = style.backgroundColor {
control.backgroundColor = backgroundColor
}
if let font = style.font {
control.font = font
placeholderAttributes[NSAttributedString.Key.font] = font
}
if let fontColor = style.fontColor {
control.textColor = fontColor
}
if let tintColor = style.tintColor {
control.tintColor = tintColor
placeholderAttributes[NSAttributedString.Key.foregroundColor] = tintColor
}
if let attributedPlaceholder = control.attributedPlaceholder, !attributedPlaceholder.string.isEmpty {
control.attributedPlaceholder = NSAttributedString(string: attributedPlaceholder.string,
attributes: placeholderAttributes)
}
}
}