Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public struct ExampleComponent: Component {
  2.  
  3. public init(id: String) {
  4. self.id = id
  5. }
  6.  
  7. var id: String
  8. var backgroundColor: UIColor = UIColor.clear
  9. var height: CGFloat = 44.0
  10.  
  11. }
  12.  
  13. public class ExampleComponentLayout: SizeLayout<UIView>, ComponentLayout {
  14.  
  15. public init(component: ExampleComponent) {
  16. let size: CGSize = CGSize(width: component.width, height: component.height)
  17. super.init(
  18. minWidth: component.width,
  19. maxWidth: component.width,
  20. minHeight: component.height,
  21. maxHeight: component.height,
  22. alignment: Alignment.center,
  23. flexibility: Flexibility.flexible,
  24. viewReuseId: "SizeLayout",
  25. sublayout: nil,
  26. config: { (view: UIView) -> Void in
  27. view.backgroundColor = component.backgroundColor
  28. }
  29. )
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement