Skip to content

Commit 1c80dff

Browse files
committed
feat: Derive core logic into swift-interception package
1 parent 1364bd5 commit 1c80dff

20 files changed

+250
-1360
lines changed

LICENCE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 CaptureContext
3+
Copyright (c) 2024 CaptureContext
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Package.swift

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// swift-tools-version:5.9
1+
// swift-tools-version: 5.9
22

33
import PackageDescription
4+
import CompilerPluginSupport
45

56
let package = Package(
67
name: "combine-interception",
@@ -18,20 +19,27 @@ let package = Package(
1819
targets: ["CombineInterception"]
1920
)
2021
],
22+
dependencies: [
23+
.package(
24+
url: "https://github.com/capturecontext/swift-interception.git",
25+
.upToNextMinor(from: "0.2.0")
26+
)
27+
],
2128
targets: [
2229
.target(
2330
name: "CombineInterception",
2431
dependencies: [
25-
.target(name: "CombineRuntime")
32+
.product(
33+
name: "Interception",
34+
package: "swift-interception"
35+
)
2636
]
2737
),
28-
.target(name: "CombineRuntime"),
29-
3038
.testTarget(
3139
name: "CombineInterceptionTests",
3240
dependencies: [
33-
.target(name: "CombineInterception")
41+
.target(name: "CombineInterception"),
3442
]
35-
)
43+
),
3644
]
3745
)

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@
22

33
[![SwiftPM 5.9](https://img.shields.io/badge/swiftpm-5.9-ED523F.svg?style=flat)](https://swift.org/download/) ![Platforms](https://img.shields.io/badge/Platforms-iOS_13_|_macOS_10.15_|_Catalyst_13_|_tvOS_14_|_watchOS_7-ED523F.svg?style=flat) [![@capturecontext](https://img.shields.io/badge/[email protected]?style=flat&logo=twitter)](https://twitter.com/capture_context)
44

5-
Package extending Apple `Combine` framework for interception of objc selectors.
5+
Combine API for interception of objc selectors in Swift.
6+
7+
Macros: [`combine-interception-macros`](https://github.com/capturecontext/combine-interception-macros)
68

79
## Usage
810

911
### Basic
1012

11-
Observe any selectors on NSObject instances
13+
Observe selectors on NSObject instances
1214

1315
```swift
14-
navigationController
15-
.publisher(for: #selector(UINavigationController.popViewController))
16-
.sink { (args, output) in
17-
// ...
18-
}
16+
navigationController.intercept(_makeMethodSelector(
17+
selector: UINavigationController.popViewController,
18+
signature: UINavigationController.popViewController
19+
))
20+
.sink { result in
21+
print(result.args) // `animated` flag
22+
print(result.output) // popped `UIViewController?`
23+
}
1924
```
2025

2126
### Library
@@ -44,7 +49,7 @@ If you use SwiftPM for your project, you can add CombineInterception to your pac
4449
```swift
4550
.package(
4651
url: "https://github.com/capturecontext/combine-interception.git",
47-
.upToNextMinor(from: "0.1.0")
52+
.upToNextMinor(from: "0.2.0")
4853
)
4954
```
5055

@@ -59,6 +64,6 @@ Do not forget about target dependencies:
5964

6065
## License
6166

62-
This library is released under the MIT license. See [LICENSE](LICENSE) for details.
67+
This library is released under the MIT license. See [LICENCE](LICENCE) for details.
6368

6469
See [ACKNOWLEDGMENTS](ACKNOWLEDGMENTS) for inspiration references and their licences.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@_exported import _InterceptionCustomSelectors

Sources/CombineInterception/NSObject+Association.swift

Lines changed: 0 additions & 159 deletions
This file was deleted.

0 commit comments

Comments
 (0)