Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 887 Bytes

README.md

File metadata and controls

31 lines (20 loc) · 887 Bytes

PublicSuffix

A Swift package that uses the Public Suffix List to parse domain names.

Usage

let components = SuffixList.default.parse("www.example.com")
print(components?.tld) // com
print(components?.sld) // example
print(components?.domain) // example.com
print(components?.subdomain) // www

SuffixList

A SuffixList is used to parse domain names.

A bundled version of the public suffix list is included as SuffixList.default. You may also use your own custom suffix list.

Installation

Xcode 11+

  • Select File > Swift Packages > Add Package Dependency...
  • Enter the package repository URL: https://github.com/jameshurst/PublicSuffix-Swift.git
  • Confirm the version and let Xcode resolve the package

License

This library is released under the MIT license. See LICENSE for details.