omitSpecificSubdomains(_:includeMultiLevelSubdomains:)
Returns a display option that omits the host component if it matches a set of subdomains.
Declaration
static func omitSpecificSubdomains(_ subdomainsToOmit: Set<String> = Set(), includeMultiLevelSubdomains omitMultiLevelSubdomains: Bool = false) -> URL.FormatStyle.HostDisplayOptionParameters
- subdomainsToOmit:
A set of subdomains to omit, such as
[”www”, “mobile”, “m”]. Matching any member of this set omits the host from the formatted output. - omitMultiLevelSubdomains:
A Boolean value to manage display of multi-level subdomains. If
true, format style omits additional subdomains if there are more than two in addition to the top-level domain (TLD). For example, when this value istrue,api.code.developer.example.combecomesdeveloper.example.com, because the TLD is“com”. By comparison,api.code.developer.example.com.cnhas a TLD of“com.cn”, so it becomesdeveloper.example.com.cn.
Return Value
A display option that omits the host component if it matches a set of subdomains.