Latest 1.0.0
Homepage https://github.com/TangentW/MessageListener
License MIT
Platforms osx , ios , tvos , watchos
Authors

A tool for monitoring objc message calls.

Carthage compatible
CocoaPods

Installation

Carthage

Add MessageListener in your Cartfile:

github "TangentW/MessageListener"

Run carthage update to build the framework and drag into your project.

Cocoapods

Add MessageListener in your Podfile:

use_frameworks!

pod "MessageListener"

Run the following command:

$ pod install

Manually

  1. Download the source code.
  2. Drag files NSObject+Listener.h and NSObject+Listener.m into your project.

Usage

Use method listen.

For normal method

Objc

[self listen: @selector(touchesBegan:withEvent:) with:^(NSArray * _Nonnull parameters) {
    NSLog(@"Touches began");
}];

Swift

listen(#selector(ViewController.touchesBegan(_:with:))) { _ in
    print("Touches began")
}

For protocol method

Objc

[self listen: @selector(tableView:didSelectRowAtIndexPath:) in:@protocol(UITableViewDelegate) with:^(NSArray * _Nonnull parameters) {
    if (parameters.count != 2) return;
    NSIndexPath *indexPath = parameters[1];
    NSLog(@"Did selected row %ld", (long)indexPath.row);
}];

Swift

listen(#selector(UITableViewDelegate.scrollViewDidScroll(_:)), in: UITableViewDelegate.self).subscribe(next: { parameters in
    guard let tableView = parameters.first as? UITableView else { return }
        print(tableView.contentOffset.y)
})
_tableView.delegate = self

License

The MIT License (MIT)

Latest podspec

{
    "name": "MessageListener",
    "version": "1.0.0",
    "summary": "A tool for monitoring message calls",
    "homepage": "https://github.com/TangentW/MessageListener",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "TangentW": "[email protected]"
    },
    "source": {
        "git": "https://github.com/TangentW/MessageListener.git",
        "tag": "1.0.0"
    },
    "source_files": "MessageListener/MessageListener/Core/*.{h,m}",
    "platforms": {
        "osx": null,
        "ios": null,
        "tvos": null,
        "watchos": null
    }
}

Pin It on Pinterest

Share This