MulticastProxy
Provides a proxy that forwards invocations to multiple receivers
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Prerequisites
- iOS 8.0+
- Xcode 9.0+
- Swift 4
Installing
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate MulticastProxy into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'MulticastProxy', '<release version>'
end
Then, run the following command:
$ pod install
Manually
If you prefer not to use either of the aforementioned dependency managers, you can integrate MulticastProxy into your project manually by adding Multicaster.h, Multicaster.m, WeakRef.h, Multicaster.h and MulticastProxy.swift source files to your project.
Deployment
Quick Start
import UIKit
import MulticastProxy
class A: UIScrollViewDelegate {
}
class B: UIScrollViewDelegate {
}
class MyViewController: UIViewController, UIScrollViewDelegate {
@IBOutlet private weak var scrollView: UIScrollView!
private var a = A()
private var b = B()
private lazy var proxyDelegate: UIScrollViewDelegate? = {
return MulticastProxy.create([a, b, self] as [UIScrollViewDelegate?])
}()
override func viewDidLoad() {
super.viewDidLoad()
scrollView.delegate = proxyDelegate
}
}
Notes
TBD
Versioning
This repo uses SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Dmitry Volosach - Initial work - @vlk1994
License
This project is licensed under the MIT License - see the LICENSE file for details