mirror of
https://github.com/nerdycat/Cupcake.git
synced 2024-10-26 14:17:13 +03:00
0.1.2
This commit is contained in:
parent
c374ae2e5b
commit
f034f409c8
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
|
||||
s.name = "Cupcake"
|
||||
s.version = "0.1.1"
|
||||
s.version = "0.1.2"
|
||||
s.summary = "An easy way to create and layout UI components for iOS."
|
||||
|
||||
s.description = <<-DESC
|
||||
|
@ -599,6 +599,35 @@ extension NSMutableAttributedString {
|
||||
}
|
||||
|
||||
|
||||
fileprivate var __flagForMethodSwizzle__: Bool = false
|
||||
|
||||
extension UIApplication {
|
||||
open override var next: UIResponder? {
|
||||
if !__flagForMethodSwizzle__ {
|
||||
__flagForMethodSwizzle__ = true
|
||||
|
||||
UIView.cpk_swizzle(method1: "setBounds:",
|
||||
method2: #selector(UIView.cpk_setBounds))
|
||||
UIView.cpk_swizzle(method1: #selector(UIView.point(inside:with:)),
|
||||
method2: #selector(UIView.cpk_point(inside:with:)))
|
||||
|
||||
UILabel.cpk_swizzle(method1: #selector(setter: UILabel.text),
|
||||
method2: #selector(UILabel.ner_setText(_:)))
|
||||
|
||||
|
||||
UITextField.cpk_swizzle(method1: #selector(UITextField.textRect(forBounds:)),
|
||||
method2: #selector(UITextField.cpk_textRect(forBounds:)))
|
||||
UITextField.cpk_swizzle(method1: #selector(UITextField.editingRect(forBounds:)),
|
||||
method2: #selector(UITextField.cpk_editingRect(forBounds:)))
|
||||
|
||||
UITextView.cpk_swizzle(method1: "dealloc", method2: #selector(UITextView.cpk_deinit))
|
||||
}
|
||||
|
||||
return super.next
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extension UIView {
|
||||
|
||||
var cpkAutoRoundingRadius: Bool {
|
||||
@ -611,13 +640,6 @@ extension UIView {
|
||||
set { cpk_setAssociated(object: newValue, forKey: #function) }
|
||||
}
|
||||
|
||||
override open class func initialize() {
|
||||
if self == UIView.self {
|
||||
cpk_swizzle(method1: "setBounds:", method2: #selector(UIView.cpk_setBounds))
|
||||
cpk_swizzle(method1: #selector(UIView.point(inside:with:)), method2: #selector(UIView.cpk_point(inside:with:)))
|
||||
}
|
||||
}
|
||||
|
||||
func cpk_setBounds(_ frame: CGRect) {
|
||||
cpk_setBounds(frame)
|
||||
|
||||
@ -772,16 +794,6 @@ extension UITextField {
|
||||
set { cpk_setAssociated(object: newValue, forKey: #function); cpk_watchOnEndEvent() }
|
||||
}
|
||||
|
||||
override open class func initialize() {
|
||||
if self == UITextField.self {
|
||||
cpk_swizzle(method1: #selector(UITextField.textRect(forBounds:)),
|
||||
method2: #selector(UITextField.cpk_textRect(forBounds:)))
|
||||
|
||||
cpk_swizzle(method1: #selector(UITextField.editingRect(forBounds:)),
|
||||
method2: #selector(UITextField.cpk_editingRect(forBounds:)))
|
||||
}
|
||||
}
|
||||
|
||||
public func cpk_textRect(forBounds bounds: CGRect) -> CGRect {
|
||||
let rect = self.cpk_textRect(forBounds: bounds)
|
||||
return UIEdgeInsetsInsetRect(rect, self.cpkPadding)
|
||||
@ -2191,12 +2203,6 @@ extension UITextView {
|
||||
return self.viewWithTag(31415) as? UITextViewPlaceholder
|
||||
}
|
||||
|
||||
override open class func initialize() {
|
||||
if self == UITextView.self {
|
||||
cpk_swizzle(method1: "dealloc", method2: #selector(UITextView.cpk_deinit))
|
||||
}
|
||||
}
|
||||
|
||||
public func cpk_deinit() {
|
||||
if let label = self.cpkPlaceholderLabel {
|
||||
for keyPath in cpkTextViewObservingKeys {
|
||||
@ -2460,12 +2466,6 @@ extension UILabel {
|
||||
set { cpk_setAssociated(object: newValue, forKey: #function) }
|
||||
}
|
||||
|
||||
override open static func initialize() {
|
||||
if self === UILabel.self {
|
||||
cpk_swizzle(method1: #selector(setter: UILabel.text), method2: #selector(UILabel.ner_setText(_:)))
|
||||
}
|
||||
}
|
||||
|
||||
public func ner_setText(_ text: String) {
|
||||
self.ner_setText(text)
|
||||
cpk_updateAttributedString()
|
||||
|
Loading…
Reference in New Issue
Block a user