Swift package · v0.1.0

KLShareLink

Select an HTTP(S) URL from explicit input or shared text.

A synchronous resolver for explicit URLs, text candidates, provider domains, and legacy source markers. It performs no network requests and rejects documented local-address forms.

Platforms
iOS 17+ · macOS 14+
Toolchain
Swift 6.0+
License
MIT
Dependencies
None

Functions

  • Provider-aware candidate precedence
  • HTTP(S)-only literal destination policy
  • JSON or value-based provider configuration
  • Synchronous, network-free, Sendable resolution

Not included

It selects input; it does not fetch, expand redirects, strip tracking, persist history, or authorize a network request.

Install with SwiftPM

Package.swiftSwift
.package(url: "https://github.com/KoenLee1023/KLShareLink.git", from: "0.1.0")

Usage

Integration exampleSwift
let resolver = ShareLinkResolver(providers: providers)
let result = resolver.resolve(
    explicitURL: itemURL,
    sharedText: itemText
)

if let url = result.url {
    open(url, source: result.providerName)
}
ShareLinkResolver

Runs explicit URL, detected candidate, provider, and legacy-token precedence.

ShareLinkProvider

Codable domain and regular-expression policy owned by the caller.

ShareLinkResolution

Keeps selected URL and provider attribution independent.

Demo apps

Link Inspector

Observe selection when realistic share text contains several URLs.

Policy Playground

Compare public destinations with loopback, private, and look-alike hosts.