Swiftpack.co - happn-app/HPNSwizzling as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by happn-app.
happn-app/HPNSwizzling 1.0.2
A method-swizzling that works.
⭐️ 9
🕓 2 years ago
.package(url: "https://github.com/happn-app/HPNSwizzling.git", from: "1.0.2")


Platforms SPM compatible License happn

A swizzling that works.


Either via SPM (recommended), or by copying NSObject+HPNSwizzling.{h,m} into your project.

Important Note

The repository does have an xcodeproj with a shared scheme for debug purposes. The project might be compatible with Carthage–or not. It is not officially supported but might work for you.


@import HPNSwizzling; /* If installed via SPM. */

@implementation NSView (MyViewAdditions)

static void MySetFrame(id self, SEL _cmd, CGRect frame);
static void (*OriginalSetFrame)(id self, SEL _cmd, CGRect frame);

static void MySetFrame(id self, SEL _cmd, CGRect frame) {
   // ***** CUSTOM WORK HERE *****
   OriginalSetFrame(self, _cmd, frame);
   // ***** OR HERE *****

+ (void)load
   CHECKED_SWIZZLE(NSView, setFrame:, MySetFrame, OriginalSetFrame);


Developers Notes

The include folder in the HPNSwizzling source code folder is there for SPM-compatibility. It contains a special HPNSwizzling.h umbrella header and a soft link to the other header.


This project was originally created by François Lamboley while working at happn.


Stars: 9
Last commit: 3 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

HPNSwizzling 1.0.2
3 years ago

Carthage support dropped.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics