String

public extension String

String+Measurer add additional support for displaying a string on the screen.

Author

Adamas

Version

1.5.0

Date

15/08/2019
  • Get the width of a string with a specific font.

    Declaration

    Swift

    func measuredWidth(with font: UIFont) -> CGFloat

    Parameters

    font

    The font.

    Return Value

    The width.

  • Get the width of a string with a specific font.

    Declaration

    Swift

    func measuredHeight(with font: UIFont) -> CGFloat

    Parameters

    font

    The font.

    Return Value

    The height.

  • Get the actual line amount displayed on the screen.

    Declaration

    Swift

    func measuredLineAmount(with font: UIFont,
                            in view: UIView) -> Int

    Parameters

    font

    The font that is applied.

    view

    The view that text is in.

    Return Value

    The actual line amount displayed on the view.

  • Get the actual height of the string displayed on the screen.

    Declaration

    Swift

    func measuredHeight(with font: UIFont, in view: UIView) -> CGFloat

    Parameters

    font

    The font that is applied.

    view

    The view that text is in.

    Return Value

    The actual height displayed on the view.

  • Get the actual lines displayed on the screen.

    Declaration

    Swift

    func measuredLines(with font: UIFont, in view: UIView) -> [String]

    Parameters

    font

    The font that is applied.

    view

    The view that text is in.

    Return Value

    The actual lines displayed on the view.