KO
|
EN
gitlite โ search
Search
#typescript
#ai-agents
#ai
#dsh-plugin
#deepseek-harness
#open-source
#claude-code
#codex
#cli
#developer-tools
#react
#windows
Linker
โ 139
Open GitHub โ
๐ฏ Your easiest way to handle all URLs.
Download README (.md)
Explore Similar Repositories
angular-7-registration-login-example
:
Angular 7 User Registration and Login Example
hopOn
:
A car rental flutter application using firebase and google maps API
carla-driving-rl-agent
:
Code for the paper "Reinforced Curriculum Learning for Autonomous Driving in CARLA" (ICIP 2021)
SwiftQRCodeScanner
:
An easy QR code reader for iOS written in Swift
ingress-merge
:
Merge Ingress Controller for Kubernetes
// repository documentation
Was this content helpful?
โ 0
(0 ratings)
Select Rating:
โ
โ
โ
โ
โ
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
Linker
?
Download (.md)
<p align="center"> <img src="Linker/Configs/logo.png"/> <h3 align="center">Linker</h3> <p align="center">Lightweight way to handle internal and external deeplinks in Swift for iOS.</p> <p align="center"> <a href="https://swift.org"><img src="https://camo.githubusercontent.com/aa026700c1aea948646712ee9108a663aa59941b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53776966742d342e782d626c75652e737667"></a> <a href="https://github.com/MaksimKurpa/Linker"><img src="https://img.shields.io/cocoapods/p/Linker.svg"></a> <a href="https://travis-ci.org/MaksimKurpa/Linker"><img src="https://travis-ci.org/MaksimKurpa/Linker.svg?branch=master"></a> <a href="https://github.com/MaksimKurpa/Linker"><img src="https://img.shields.io/cocoapods/v/Linker.svg"></a> <a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat"></a> <a href="https://raw.githubusercontent.com/Linker/master/LICENSE"><img src="https://img.shields.io/cocoapods/l/Linker.svg"></a> </p> </p> --- ## Installation ### Dependency Managers <details> <summary><strong>CocoaPods</strong></summary> [CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: ```bash $ gem install cocoapods ``` To integrate Linker into your Xcode project using CocoaPods, specify it in your `Podfile`: ```ruby source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' use_frameworks! pod 'Linker' ``` Then, run the following command: ```bash $ pod install ``` </details> <details> <summary><strong>Carthage</strong></summary> [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application. You can install Carthage with [Homebrew](http://brew.sh/) using the following command: ```bash $ brew update $ brew install carthage ``` To integrate Linker into your Xcode project using Carthage, specify it in your `Cartfile`: ```ogdl github "Linker" ``` </details> ## Usage (see sample Xcode project Demo) The main thought of this framework is useful and convenient handling of external and internal URLs in your iOS application. Linker provides only one function to install your own handler to specific URL. A dependency between specific URL and your closure is based on `scheme` and `host` of each URL. That is you can configure miscellaneous behavior for different components of specific URL. You can split handling by `query` with different parameters and/or by `path`, `fragment`. <details> <summary><strong>Realization details</strong></summary> On start of your application occurs swizzling methods in `UIApplication` and `UIApplicationDelegate` of your application. Original implementation exchanged on Linker's implementation, where occur handle process. If Linker can't handle specific URL, original implementation of this method will be called. Swizzled functions: `UIApplication.shared - openURL:options:completionHandler:` `UIApplication.shared - openURL:` (deprecated since iOS 10.0) `UIApplication.shared.delegate - application:openURL:options:` `UIApplication.shared.delegate - application:openURL:sourceApplication:annotation:` (deprecated since iOS 9.0) `UIApplication.shared.delegate - application:handleOpenURL:` (deprecated since iOS 9.0) </details> For complience with URL style, use format: `your_app_url_scheme://inapp_am/buy_subscription?type=subscription&productID=com.yourapp.7days_trial#test` where: scheme - `your_app_url_scheme`, host - `inapp_am`, path - `buy_subscription` query - `type=subscription&productID=com.yourapp.7days_trial` fragment - `test` If you don't need configuration with complexed behavior, you can use URL just with `host`: `your_app_url_scheme://some_host_from_your_app` One special case - handle external URLs when app isn't launched. You should install closure for specific URL and if this url will be in pair with `UIApplicationLaunchOptionsKey` in `launchOptions` - this url will be handled. ```Swift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let launchURL = URL(string: "linker://launchURL")! //if launchUrl equal launchOptions?[UIApplicationLaunchOptionsKey.url] -> this closure will be handled after app launch Linker.handle(launchURL, closure: { url in print("Your URL has been handle!") }) return true } ``` In other cases of usage you should set your handle closure for special URL before calling its from somewhere. If you have a few places where you need handle one specific url, you should reassign closure where latest set closure should have right `context`. <h5> (!) Notice: Only the last sent closure for a unique URL (scheme + host) will be executed.</h5> ```Swift class ViewController: UIViewController { let sourceURL = URL(string: "linker://viewcontroller?title=ExampleAlert&description=ExampleDescriptionAlert")! @IBAction func action(_ sender: Any) { UIApplication.shared.open(sourceURL, options: [:], completionHandler: nil) } override func viewDidLoad() { super.viewDidLoad() Linker.handle(sourceURL) { url in guard let queryItems = URLComponents(url: url, resolvingAgainstBaseURL: true)?.queryItems! else { return } var title : String? = nil var description: String? = nil for item in queryItems { if item.name == "title" { title = item.value } if item.name == "description" { description = item.value; } } if let name = title, let message = description { let alertVC = UIAlertController(title: name, message: message, preferredStyle: UIAlertControllerStyle.alert) alertVC.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: {action in alertVC.dismiss(animated: true, completion: nil) })) self.present(alertVC, animated: false, completion: nil) } } } } ``` You can also find Objective-C version of this [here](https://github.com/MaksimKurpa/DeepLinksHandler). ## Contributing Issues and pull requests are welcome! ## Author Maksim Kurpa - [@maksim_kurpa](https://twitter.com/maksim_kurpa) ## License This code is distributed under the terms and conditions of the [MIT license](https://raw.githubusercontent.com/MaksimKurpa/Linker/master/LICENSE).