Coder Social home page Coder Social logo

hyperlabel's Introduction

HyperLabel

HyperLabel is a UILabel replacement which suports adding links for arbitraray part of the text

Features

UI Automation support

HyperLabel supports setting custom accessibilityIdentifier for added links

VoiceOver

All added links will have proper description and will be accessible with VoiceOver

No subclassing needed

If you already have a subclass of UILabel, you can add HyperLabel functionallity to it. Just by conform it to HyperLabelProtocol and call initializeHyperLabel

Usage

let label = HLHyperLabel()

// Set additional attributes which will be applied for added links
label.additionalLinkAttributes = [
    NSAttributedString.Key.foregroundColor: UIColor.red,
    NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue
]

// Set text
label.text = "Hello world!"

// Get range of the link
let linkRange = (text as NSString).range(of: "world")

// Add handler for range
label.addLink(withRange: linkRange) {
    // On link press
}

Installation

Carthage

Add HyperLabel to your Cartfile:

github "badoo/HyperLabel"

Manual

  1. Add as a submodule or download
  2. Drag HyperLabel.xcodeproj inside of your project
  3. Add HyperLabel.framework to Target Dependencies
  4. Add HyperLabel.framework to Embedded Binaries

License

Source code is distributed under MIT license

hyperlabel's People

Contributors

wiruzx avatar dive avatar ssimboss avatar leonspok avatar radekcieciwa avatar

Stargazers

NSR avatar Alexandre dos Santos avatar  avatar Peter Salz avatar  avatar Dmytro Lagoda avatar  avatar Nikita Pekurin avatar  avatar Geart Otten avatar Carmen Geelhaar avatar wonkwh avatar Sergey Chausov avatar Muhammad Naveed avatar Anton Schukin avatar Igor Kashkuta avatar

Watchers

Asif Mujteba avatar Alexis Santos Pérez avatar Alex Kremer avatar Jonathan Crooke avatar James Cloos avatar Raul Menezes avatar Mike R avatar Damir Davletov avatar Valerii Che avatar Anton Schukin avatar Martin Nygren avatar Mikhail Gasanov avatar MANIAK_dobrii avatar Artem Kirillov avatar  avatar  avatar  avatar Chebotov avatar  avatar Farzad Sharbafian avatar Alexandre dos Santos avatar  avatar Peter Salz avatar

hyperlabel's Issues

App Error While drag and drop the app manually.

Could not cast value of type 'NSKVONotifying_UILabel' (0x600000d89a70) to 'HyperLabel.HLHyperLabel' (0x10dfd39f8).

2020-08-25 10:59:36.980940+0530 SMAAX[6264:153674] Could not cast value of type 'NSKVONotifying_UILabel' (0x600000d89a70) to 'HyperLabel.HLHyperLabel' (0x10dfd39f8).

Can you please help me how to solve this crash issue.

Can you please provide me pod file link.

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.