Created
March 22, 2018 11:14
-
-
Save sanllier/7737ee99a427e93cd847d9f516e8b1c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@objc func _needsDoubleUpdateConstraintsPass() -> Bool { | |
return true | |
} | |
override var intrinsicContentSize: CGSize { | |
return attributedText?.size(forWidth: (engineBounds ?? bounds).width) ?? .zero | |
} | |
var engineBounds: CGRect? { | |
let objcSelector = "_nsis_compatibleBoundsInEngine:") | |
typealias CFunction = @convention(c) (AnyObject, Selector, Any) -> CGRect | |
let impl = class_getMethodImplementation(type(of: self).self, objcSelector) | |
let callableImpl = unsafeBitCast(impl, to: CFunction.self) | |
return layoutEngine.flatMap { callableImpl(self, objcSelector, $0) } | |
} | |
var layoutEngine: Any? { | |
let objcSelector = "_nsli_layoutEngine:") | |
typealias CFunction = @convention(c) (AnyObject, Selector) -> Any | |
let impl = class_getMethodImplementation(type(of: self).self, objcSelector) | |
let callableImpl = unsafeBitCast(impl, to: CFunction.self) | |
return callableImpl(self, objcSelector) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment