MessageKit Swift didSelectURL doesn't work

感情迁移 提交于 2020-06-29 04:13:52

问题


I'm trying to open url from messages and i'm using 3.0.0-beta-swift5 version of MessageKit. I implemented the delegate methods.

    func detectorAttributes(for detector: DetectorType, and message: MessageType, at indexPath: IndexPath) -> [NSAttributedString.Key: Any] {
     switch detector {
     case .hashtag, .mention, .url: return [.foregroundColor: UIColor.blue]
     default: return MessageLabel.defaultAttributes
     }
   }

 func enabledDetectors(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> [DetectorType] {
     return [.url, .address, .phoneNumber, .date, .transitInformation, .mention, .hashtag]
 }

I implemented the didSelectURL but it doesn't triggered.

func didSelectURL(_ url: URL) {
        let config = SFSafariViewController.Configuration()

        let vc = SFSafariViewController(url: url, configuration: config)
        present(vc, animated: true)
}

来源:https://stackoverflow.com/questions/60829294/messagekit-swift-didselecturl-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!