Instance Property
rangeOfFragment
iOS 9.0+
iPadOS 9.0+
Mac Catalyst 9.0+
macOS 10.11+
tvOS 9.0+
watchOS 2.0+
The character range of the fragment in the
string property.var rangeOfFragment: Range<String.Index>? { get }
Discussion
If the component does not exist, nil is returned.
Note
Zero length components are legal. For example, the URL string “scheme://:@/?#” has a zero length user, password, host, query and fragment; the URL strings “scheme:” and “” both have a zero length path.