CGFloat
struct CGFloat
-
Occasionally we do want UI elements to be a little bigger or wider on bigger screens, such as with label widths. This can be used to increase values based on screen size. It uses the small screen (320 wide) as a baseline. This is a much simpler alternative to defining a matrix with screen sizes and constants and achieves much the same result
Declaration
Swift
public func rsd_proportionalToScreenWidth(max: CGFloat = CGFloat.greatestFiniteMagnitude) -> CGFloat
Parameters
max
A maximum size to apply to the returned value.
-
Occasionally we want padding to be a little bigger or longer on bigger screens. This can be used to increase values based on screen size. It uses the small screen (568 high) as a baseline. This is a much simpler alternative to defining a matrix with screen sizes and constants and achieves much the same result.
Declaration
Swift
public func rsd_proportionalToScreenHeight(max: CGFloat = CGFloat.greatestFiniteMagnitude) -> CGFloat
Parameters
max
A maximum size to apply to the returned value.
-
Occasionally we want padding to be a little bigger or longer on bigger screens. This method will apply the
multiplier
if and only if this is an iPad.Note
This does not check the size class of the view.Declaration
Swift
public func rsd_iPadMultiplier(_ multiplier: CGFloat) -> CGFloat
Parameters
multiplier
The value to multiply by if this is an iPad.