Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public struct ExampleComponent: Component {
- public init(id: String) {
- self.id = id
- }
- var id: String
- var backgroundColor: UIColor = UIColor.clear
- var height: CGFloat = 44.0
- }
- public class ExampleComponentLayout: SizeLayout<UIView>, ComponentLayout {
- public init(component: ExampleComponent) {
- let size: CGSize = CGSize(width: component.width, height: component.height)
- super.init(
- minWidth: component.width,
- maxWidth: component.width,
- minHeight: component.height,
- maxHeight: component.height,
- alignment: Alignment.center,
- flexibility: Flexibility.flexible,
- viewReuseId: "SizeLayout",
- sublayout: nil,
- config: { (view: UIView) -> Void in
- view.backgroundColor = component.backgroundColor
- }
- )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement