-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from will-lumley/feature/add-support-for-og
[FEAT] Add Support for OpenGraph Type
- Loading branch information
Showing
21 changed files
with
318 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Sources/FaviconFinder/Toolbox/Extensions/String+URLQuery.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// String+URLQuery.swift | ||
// FaviconFinder | ||
// | ||
// Created by William Lumley on 25/9/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
extension String { | ||
|
||
/// Extracts the value of a query parameter by its name from a URL string. | ||
/// - parameter name: The name of the query parameter. | ||
/// - returns: The value of the query parameter, or nil if not found. | ||
/// | ||
func valueOfQueryParam(_ name: String) -> String? { | ||
guard let url = URL(string: self), | ||
let components = URLComponents(url: url, resolvingAgainstBaseURL: false), | ||
let queryItems = components.queryItems else { | ||
return nil | ||
} | ||
return queryItems.first(where: { $0.name == name })?.value | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// Size.swift | ||
// FaviconFinder | ||
// | ||
// Created by William Lumley on 26/9/2024. | ||
// | ||
|
||
public struct FaviconSize: Equatable, Sendable { | ||
|
||
// MARK: - Properties | ||
|
||
public let width: Double | ||
public let height: Double | ||
|
||
// MARK: - Lifecycle | ||
|
||
init(width: Double, height: Double) { | ||
self.width = width | ||
self.height = height | ||
} | ||
|
||
init?(widthStr: String, heightStr: String) { | ||
guard | ||
let width = Double(widthStr), | ||
let height = Double(heightStr) else { | ||
return nil | ||
} | ||
|
||
self.width = width | ||
self.height = height | ||
} | ||
|
||
} | ||
|
||
// MARK: - Public | ||
|
||
public extension FaviconSize { | ||
|
||
var dimension: Double { | ||
self.width * self.height | ||
} | ||
|
||
} |
Oops, something went wrong.