Skip to content

Functions that calculate the size of uilabel based on different string lengths.

License

Notifications You must be signed in to change notification settings

donggyushin/DGLabelSize

Repository files navigation

DGLabelSize

Functions that calculate the size of uilabel based on different string lengths.

Requirements

  • iOS 12.0+
  • Swift 5.5+
  • Xcode 10.0+

Installation

SPM

File > Add Packages > https://github.com/donggyushin/DGLabelSize

CocoaPod

pod 'DGLabelSize', :git => 'https://github.com/donggyushin/DGLabelSize.git'

Usage

let label: UILabel = {
    let view = UILabel()
    view.text = "short text"
    return view
}()

// Get label's height
DGLabelSize.height(maxWidth: maxWidth, maxHeight: maxHeight, label)

// Get label's width
DGLabelSize.width(maxHeight: maxHeight, maxWidth: maxWidth, label)

About

Functions that calculate the size of uilabel based on different string lengths.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published