MapCopyrights
final public class MapCopyrights
                Provides methods to fetch copyrights and caption.
Important
This is a Public Preview API. It may be changed or removed at any time.- 
                  
                  
Creates a
MapCopyrightsinstance.Declaration
Swift
public convenience init() 
- 
                  
fetchCopyrights()AsynchronousFetches copyright details.
For users who are utilizing iOS 15+ and leveraging SwiftUI to ensure accurate rendering of hyperlinks that are interactive (tappable) and capable of opening in the web browser, the following method can be employed:
func parseContent(_ content: String) -> AttributedString { do { let detector = try NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) let matches = detector.matches(in: content, options: [], range: NSRange(location: 0, length: content.utf16.count)) let modifiedContent = NSMutableAttributedString(string: content) for match in matches.reversed() { guard let range = Range(match.range, in: content) else { continue } let url = content[range] let markdownLink = "[\(url)](\(url))" let markdownAttributedString = try AttributedString(markdown: markdownLink) modifiedContent.replaceCharacters(in: match.range, with: NSAttributedString(markdownAttributedString)) } return AttributedString(modifiedContent) } catch { return AttributedString("Something went wrong during the Copyright parsing.") } }Example of usage of this method:
Text(parseContent(text))Throws
An error occurred during the retrieval process.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func fetchCopyrights() async throws -> StringReturn Value
String copyright details in HTML format.
 - 
                  
                  
Fetches copyright details.
For users who are utilizing iOS 15+ and leveraging SwiftUI to ensure accurate rendering of hyperlinks that are interactive (tappable) and capable of opening in the web browser, the following method can be employed:
func parseContent(_ content: String) -> AttributedString { do { let detector = try NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) let matches = detector.matches(in: content, options: [], range: NSRange(location: 0, length: content.utf16.count)) let modifiedContent = NSMutableAttributedString(string: content) for match in matches.reversed() { guard let range = Range(match.range, in: content) else { continue } let url = content[range] let markdownLink = "[\(url)](\(url))" let markdownAttributedString = try AttributedString(markdown: markdownLink) modifiedContent.replaceCharacters(in: match.range, with: NSAttributedString(markdownAttributedString)) } return AttributedString(modifiedContent) } catch { return AttributedString("Something went wrong during the Copyright parsing.") } }Example of usage of this method:
Text(parseContent(text))Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
@discardableResult public func fetchCopyrights(completion: @escaping (Result<String, Error>) -> ()) -> CancellableParameters
completionCompletion handler that is called to receive the copyrights. If no errors occurred, string contain caption.
Return Value
A
Cancellablefor the network request operation. - 
                  
fetchCaption()AsynchronousFetches copyrights caption.
Throws
An error occurred during the retrieval process.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func fetchCaption() async throws -> StringReturn Value
String copyrights caption in HTML format.
 - 
                  
                  
Fetches copyrights caption.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
@discardableResult public func fetchCaption(completion: @escaping (Result<String, Error>) -> ()) -> CancellableParameters
completionCompletion handler that is called to receive the copyrights. If no errors occurred, string contain caption.
Return Value
A
Cancellablefor the network request operation. 
        
 
          TomTom SDK for iOS (0.51.1)
        
          MapCopyrights