Skip to content

Commit f03395f

Browse files
committed
Merge branch 'master' of github.com:steipete/InterposeKit
2 parents 7780737 + 85f6c2d commit f03395f

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

.github/workflows/greetings.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Greetings
2+
3+
on: [pull_request, issues]
4+
5+
jobs:
6+
greeting:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/first-interaction@v1
10+
with:
11+
repo-token: ${{ secrets.GITHUB_TOKEN }}
12+
issue-message: 'Hey there! Thanks for writing an issue! 👋'' first issue'
13+
pr-message: 'Hey there! Thanks for making a PR! 🙏'' first pr'

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
[![SwiftPM](https://github.com/steipete/InterposeKit/workflows/SwiftPM/badge.svg)](https://github.com/jsteipete/InterposeKit/actions?query=workflow%3ASwiftPM)
44
[![xcodebuild](https://github.com/steipete/InterposeKit/workflows/xcodebuild/badge.svg)](https://github.com/steipete/InterposeKit/actions?query=workflow%3Axcodebuild)
55
[![pod lib lint](https://github.com/steipete/InterposeKit/workflows/pod%20lib%20lint/badge.svg)](https://github.com/steipete/InterposeKit/actions?query=workflow%3A%22pod+lib+lint%22)
6-
[![codecov](https://codecov.io/gh/steipete/InterposeKit/branch/master/graph/badge.svg)](https://codecov.io/gh/steipete/InterposeKit)
76
![Xcode 11.4+](https://img.shields.io/badge/Xcode-11.4%2B-blue.svg)
87
![Swift 5.2+](https://img.shields.io/badge/Swift-5.2%2B-orange.svg)
8+
<!--
9+
[![codecov](https://codecov.io/gh/steipete/InterposeKit/branch/master/graph/badge.svg)](https://codecov.io/gh/steipete/InterposeKit) -->
910

1011
Interpose is a modern library to swizzle elegantly in Swift. It is fully written in Swift 5.2+ and works on `@objc dynamic` Swift functions or Objective-C instance methods. API documentation available at [steipete.github.io/InterposeKit](https://steipete.github.io/InterposeKit/)
1112

12-
Instead of adding new methods and exchanging implementations, this library replaces the implementation directly.
13+
Instead of [adding new methods and exchanging implementations](https://nshipster.com/method-swizzling/), this library replaces the implementation directly.
1314
This avoids some of [the usual problems with swizzling](https://pspdfkit.com/blog/2019/swizzling-in-swift/).
1415

1516
You can call the original implementation and add code before, instead or after a method call.
1617
This is similart o the [Aspects library](https://github.com/steipete/Aspects).
1718

19+
## Usage
20+
1821
Let's say you want to amend `sayHi` from `TestClass`:
1922

2023
```swift
@@ -75,6 +78,20 @@ try Interpose.whenAvailable(["RTIInput", "SystemSession"]) {
7578
}
7679
```
7780

81+
## FAQ
82+
83+
### Why didn't you call it Interpose? "Kit" feels so old-school.
84+
Naming it Interpose was the plan, but then [SR-898](https://bugs.swift.org/browse/SR-898) came. While having a class with the same name as the module works [in most cases](https://forums.swift.org/t/frameworkname-is-not-a-member-type-of-frameworkname-errors-inside-swiftinterface/28962), [this breaks](https://twitter.com/BalestraPatrick/status/1260928023357878273) when you enable build-for-distribution. There's some [discussion](https://forums.swift.org/t/pitch-fully-qualified-name-syntax/28482/81) to get that fixed, but this will be more towards end of 2020, if even.
85+
86+
### I want to hook into Swift! You made another ObjC swizzle thingy, why?
87+
UIKit and AppKit won't go away, and the bugs won't go away either. I see this as a rarely-needed instrument to fix system-level issues. There are ways to do some of that in Swift, but that's a separate (and much more difficult!) project.
88+
89+
### Can I ship this?
90+
Yes, absolutely. The goal for this one prokect is a simple library that doesn't try to be too smart. I did this in [Aspects](https://github.com/steipete/Aspects) and while I loved this to no end, it's problematic and can cause side-effects with other code that tries to be clever. InterposeKit is boring, so you don't have to worry about conditions like "We added New Relic to our app and now [your thing crashes](https://github.com/steipete/Aspects/issues/21)".
91+
92+
### It does not do X
93+
Pull Requests welcome! You might wanna open a draft before to lay out what you plan, I want to keep the feature-set minimal so it stays simple and no-magic.
94+
7895
## Installation
7996

8097
Building InterposeKit requires Xcode 11.4+ or a Swift 5.2+ toolchain with the Swift Package Manager.
@@ -107,6 +124,10 @@ Make this happen:
107124
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
108125
![CocoaPods](https://img.shields.io/cocoapods/v/SwiftyJSON.svg)
109126

127+
## Thanks
128+
129+
Special thanks to [JP Simard](https://github.com/jpsim/Yams) who did such a great job in setting up [Yams](https://github.com/jpsim/Yams) with GitHub Actions - this was extremely helpful to build CI here fast.
130+
110131
## License
111132

112133
InterposeKit is MIT Licensed.

0 commit comments

Comments
 (0)