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

Related tags

Utility swift
Overview

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'

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)
You might also like...
Call Swift functions from Rust with ease!

swift-rs Call Swift functions from Rust with ease! Todo Swift class deallocation from rust (implementing Drop and using deallocate_{type} methods) Mor

A set of helper classes and functions in Swift

SwiftTools This is a set of tools written in Swift that add some sugar and some small functionality. Mainly meant for small projects and scripts, as a

Utility functions for validating IBOutlet and IBAction connections
Utility functions for validating IBOutlet and IBAction connections

Outlets Utility functions for validating IBOutlet and IBAction connections. About Outlets provides a set of functions which validate that IBOutlets ar

Useful functions and extensions for sorting in Swift

SwiftSortUtils Motivation This library takes a shot at making comparing and sorting in Swift more pleasant. It also allows you to reuse your old NSSor

👷‍♀️ Closure-based delegation without memory leaks

Delegated 2.0 Delegated is a super small package that helps you avoid retain cycles when using closure-based delegation. New Medium post here. Origina

📦 KeyPath dynamicMemberLookup based syntax sugar for Swift.

DuctTape 📦 KeyPath dynamicMemberLookup based syntax sugar for Swift. let label: UILabel = UILabel().ductTape .numberOfLines(0) .textColor(.re

RResultBuilder is DSL library based on Result Builder
RResultBuilder is DSL library based on Result Builder

RResultBuilder is DSL library based on Result Builder Features Requirements Installation Usage Screenshot Example Contribute Meta Feat

Automatically set your keyboard's backlight based on your Mac's ambient light sensor.
Automatically set your keyboard's backlight based on your Mac's ambient light sensor.

QMK Ambient Backlight Automatically set your keyboard's backlight based on your Mac's ambient light sensor. Compatibility macOS Big Sur or later, a Ma

Proper YAML support for Objective-C. Based on recommended libyaml.

YAML.framework for Objective-C Based on C LibYAML library (http://pyyaml.org/wiki/LibYAML) by Kirill Simonov. YAML.framework provides support for YAML

Releases(v1.0.0)
  • v1.0.0(Jan 27, 2022)

    What's Changed

    • [Feature] configs by @donggyushin in https://github.com/donggyushin/DGLabelSize/pull/2
    • [Feature] Github Actions by @donggyushin in https://github.com/donggyushin/DGLabelSize/pull/1
    • [Feature] Wrote height and width functions and test cases by @donggyushin in https://github.com/donggyushin/DGLabelSize/pull/3
    • [Release] v1.0.0 by @donggyushin in https://github.com/donggyushin/DGLabelSize/pull/4

    New Contributors

    • @donggyushin made their first contribution in https://github.com/donggyushin/DGLabelSize/pull/2

    Full Changelog: https://github.com/donggyushin/DGLabelSize/commits/v1.0.0

    Source code(tar.gz)
    Source code(zip)
Owner
donggyu
Write many code to write less code
donggyu
Extendy - A set of useful string extensions.

Extendy A set of useful string extensions. Requirements iOS 11.0+ Swift 5+ Installation CocoaPods Extendy is available through CocoaPods. To install i

Anton Novichenko 3 Sep 23, 2021
This package will contain the standard encodings/decodings/hahsing used by the String Conversion Tool app.

This package will contain the standard encodings/decodings/hahsing used by the String Conversion Tool app. It will also, however, contain extra encoding/decoding methods (new encoding/decoding)

Gleb 0 Oct 16, 2021
Taking a string containing a csv file and split it into records (aka lines) containing fields of data (aka Array of SubStrings)

Swift .csv parser Taking a string containing a csv file and split it into records (aka lines) containing fields of data (aka Array of SubStrings). Par

Matthias 0 Dec 29, 2021
Decode a string encoded in Base64 into an https link and launch it in Google Chrome

Decode a string encoded in Base64 into an https link and launch it in Google Chr

Jerry 0 Jan 2, 2022
EmbeddedStringsKit: Representation localized string in code

EmbeddedStringsKit Representation localized string in code Usage public struct L

Muukii 1 Jul 13, 2022
ParserCombinators - String Parser Construction Kit

ParserCombinators provides a set of elementary building blocks for deriving stru

Marcel Tesch 0 Jan 7, 2022
TypeStyle is a handy app for iPhone and iPad that generates text using different styles and decorations. It is a native Swift iOS app.

TypeStyle TypeStyle is a handy app for iPhone and iPad that generates text using different styles and decorations. It is a native Swift iOS app. Featu

Eugene Belinski 31 Dec 14, 2022
Swift-friendly API for a set of powerful Objective C runtime functions.

ObjectiveKit ObjectiveKit provides a Swift friendly API for a set of powerful Objective C runtime functions. Usage To use ObjectiveKit: Import Objecti

Roy Marmelstein 850 Oct 25, 2022
Infix operators for monadic functions in Swift

Indecipherable symbols that some people claim have actual meaning. Please see the documentation for installation instructions. What's included? Import

thoughtbot, inc. 825 Dec 7, 2022
Functional data types and functions for any project

Swiftx Swiftx is a Swift library containing functional abstractions and extensions to the Swift Standard Library. Swiftx is a smaller and simpler way

TypeLift 219 Aug 30, 2022