Last active
April 5, 2017 23:23
-
-
Save cesteban/e5d265989ed319c0f83bfda3bffdcf8c to your computer and use it in GitHub Desktop.
Ideas for ASDKFluentExtensions in Swift
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
extension ASLayoutElement { | |
public func withOverlay(_ overlay: ASLayoutElement) -> ASOverlayLayoutSpec { | |
return ASOverlayLayoutSpec(child: self, overlay: overlay) | |
} | |
public func withBackgorund(_ background: ASLayoutElement) -> ASBackgroundLayoutSpec { | |
return ASBackgroundLayoutSpec(child: self, background: background) | |
} | |
public func withRatio(_ ratio: CGFloat) -> ASRatioLayoutSpec { | |
return ASRatioLayoutSpec(ratio: ratio, child: self) | |
} | |
public func withInset(_ insets: UIEdgeInsets) -> ASInsetLayoutSpec { | |
return ASInsetLayoutSpec(insets: insets, child: self) | |
} | |
public func withRelativePosition(horizontal: ASRelativeLayoutSpecPosition = .none, vertical: ASRelativeLayoutSpecPosition = .none, sizing: ASRelativeLayoutSpecSizingOption = []) -> ASRelativeLayoutSpec { | |
return ASRelativeLayoutSpec(horizontalPosition: horizontal, verticalPosition: vertical, sizingOption: sizing, child: self) | |
} | |
public func wrap() -> ASWrapperLayoutSpec { | |
return ASWrapperLayoutSpec(layoutElement: self) | |
} | |
public func center(centeringOptions: ASCenterLayoutSpecCenteringOptions = [], sizingOptions: ASCenterLayoutSpecSizingOptions = []) -> ASCenterLayoutSpec { | |
return ASCenterLayoutSpec(centeringOptions: centeringOptions, sizingOptions: sizingOptions, child: self) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment