Git Product home page Git Product logo

uilabelattributedtexthelper's Introduction

UILabelAttributedTextHelper

A quick helper for setting attributed texts to UILabel.

Screen Shot 2021-11-20 at 10 46 24 AM

Sample usage:

    label.setAttributedText(
        leadingText: "Hello!",
        leadingTextColor: .red,
        leadingTextFont: .boldSystemFont(ofSize: 20)
    )
    
    
    label2.setAttributedText(
        leadingText: "Hello",
        leadingTextColor: .blue,
        leadingTextFont: .boldSystemFont(ofSize: 20),
        trailingText: ", World!",
        trailingTextColor: .red,
        trailingTextFont: .italicSystemFont(ofSize: 20),
        textAlignment: .left,
        numberOfLines: 2,
        lineHeightMultiple: 1,
        lineSpacing: 1
    )
    
    label3.setAttributedText(
        completeString: "I believe that hard work beats talent. This is case sensitive. I learned the value of hard work by working hard",
        textColor: .label,
        font: .systemFont(ofSize: 20),
        highlightedText: "hard work",
        highlightedTextColor: .blue,
        highlightedTextFont: .boldSystemFont(ofSize: 25),
        textAlignment: .right,
        numberOfLines: 0,
        highlightAllOccurrence: false,
        lineHeightMultiple: 1,
        lineSpacing: 1
    )
    
    label4.setAttributedText(
        completeString: "I believe that hard work beats talent. This is case sensitive. I learned the value of hard work by working hard",
        textColor: .label,
        font: .systemFont(ofSize: 20),
        highlightedText: "hard work",
        highlightedTextColor: .blue,
        highlightedTextFont: .boldSystemFont(ofSize: 25),
        textAlignment: .center,
        numberOfLines: 0,
        highlightAllOccurrence: true,
        lineHeightMultiple: 1,
        lineSpacing: 1
    )

uilabelattributedtexthelper's People

Contributors

glennposadas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.