 
 import UIKit
 import LNKLabel
+import SafariServices
+import MessageUI
 
 class ViewController: UIViewController {
 

    
}


extension ViewController: 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:
            print("taped custom pattern: \(matchText)")
        }

        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        let label = LNKLabel()
        label.linkPatterns = [MailPattern(), URLPattern(), PhonePattern()]
        label.linkPatterns?.append(CustomPattern())
        label.text = "https://github.com/asashin227/LNKLabel\n09012345678\naaa.bbb@ccc.com\nhogehogefugafuga"
        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)
    }

