问题
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