Project Briefing
FaviconFinder is a small, pure Swift library designed for iOS and macOS applications that allows you to detect favicons used by a website.
Why not just download the file that exists at https://site.com/favicon.ico
? There are multiple places that a developer can place their favicon, not just at the root directory with the specific filename of favicon.ico
. The favicon’s address may be linked within the HTML header tags, or it may be within a web application manifest JSON file, or it could even be a file with a custom filename.
FaviconFinder handles the dirty work for you and iterates through the numerous possible favicon locations, and simply delivers the image to you in a closure, once the image is found.
FaviconFinder will:
- Detect the favicon in the root directory of the URL provided.
- Automatically check if the favicon is located within the root URL if the subdomain failed (Will check
https://site.com/favicon.ico
ifhttps://subdomain.site.com/favicon.ico
fails). - Detect and parse the HTML at the URL for the declaration of the favicon.
- Resolve the favicon URL for you, even if it’s a relative URL to the subdomain that you’re querying.
- Allow you to prioritise which format of favicon you would like served.
- Detect and parse web application manifest JSON files for favicon locations.
- If you set
checkForMetaRefreshRedirect
to true, FaviconFinder will analyse the HTML for a meta refresh redirect tag. If such a tag is found, the URL in the tag is the URL that will be queried.
Technical Details
- FaviconFinder uses Swift 5, and runs for the iOS, macOS, and Linux platforms.
- The FaviconFinder project uses the MIT licence, and is hosted on Github.
- FaviconFinder supports CocoaPods, Carthage and Swift Package Manager.
- FaviconFinder uses unit tests in conjunction with Github Actions to ensure consistent code quality is maintained.