Latest 0.2.0
Homepage https://github.com/asashin227/LNKLabel
License MIT
Platforms ios 9.0
Authors

CI Status
Version
License
Platform

LNKLabel is customed UILabel that is linkable and highlighted.

Usage

Make linkale label

let label = LNKLabel()
label.linkPatterns = [MailPattern(), URLPattern(), PhonePattern()]
label.text = "https://github.com/asashin227/[email protected]"
label.delegate = self
label.numberOfLines = 0
label.frame.size.width = UIScreen.main.bounds.size.width
label.sizeToFit()
label.center = self.view.center
view.addSubview(label)

Receive taped callback

extension YourClass: LNKLabelDelegate {

    func didTaped(label: LNKLabel, pattern: Pattern, matchText: String, range: NSRange) {
        switch pattern {
        case is URLPattern:
            print("taped url link: (matchText)")
        case is MailPattern:
            print("taped mail address: (matchText)")
        case is PhonePattern:
            print("taped phone number: (matchText)")
        default:
            break
        }
    }

}

Make custom link pattern

public class CustomPattern: Pattern {
    override public var regString: String {
        return "hogehoge"
    }
}

and add for link

label.linkPatterns?.append(CustomPattern())

Installation

LNKLabel is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'LNKLabel'

License

LNKLabel is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "LNKLabel",
    "version": "0.2.0",
    "summary": "Inputed link text automatic appending attribute.",
    "description": "Inputed link text automatic appending attribute.nsupporting linksn- URLn- Phone numbern- E-mail address",
    "homepage": "https://github.com/asashin227/LNKLabel",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "asashin227": "[email protected]"
    },
    "source": {
        "git": "https://github.com/asashin227/LNKLabel.git",
        "tag": "0.2.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "LNKLabel/Classes/**/*",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This