Questions tagged [swizzling]

Swizzling refers to the extraction, rearrangement, and possible duplication of elements of tuple types. On many GPUs swizzling is free or at least cheap, and smart use of swizzling can make your code more efficient. However, inappropriate use of swizzling can also make your code incredibly hard to read, and may make it hard for the compiler to optimize it.

Swizzling refers to the extraction, rearrangement, and possible duplication of elements of tuple types. On many GPUs swizzling is free or at least cheap, and smart use of swizzling can make your code more efficient. However, inappropriate use of swizzling can also make your code incredibly hard to read, and may make it hard for the compiler to optimize it.

Matrices may also be swizzled, but they require two swizzle operations in sequence. The first (leftmost) swizzle is a swizzle on rows, the second (rightmost) swizzle is a swizzle on columns. This notation permits permutation of rows and columns as well as the extraction of submatrices.

See Swizzling and Write Masking.

151 questions
1
vote
1 answer

How to implement app behavior when user turn off notification in device setting for iOS using Firebase FCM swizzling turned on?

If I enable FCM swizzling in iOS, I found that the FCM token is still there even when user turns off the device notification setting for my app(probably saved in app data). It seems not logical to manage this setting anymore inside the app since FCM…
1
vote
0 answers

Objective C: Method Swizzling of UITableViewDelegate method

I am using method swizzling in my project using (JRSwizzle). I have implemented swizzling for "UIViewController" and "UIButton". It works fine. But i am having trouble in swizzling a UITableViewDelegate method "willDisplayCell". Can anyone provide…
MaK
  • 81
  • 1
  • 7
1
vote
2 answers

How to swizzle NSURLSession method dataTaskWithUrl

I have been trying to swizzle the dataTaskWithURL method of NSURLSession class.This is what i have tried + (void)swizzleDataTaskWithRequest { Class class = [self class]; SEL originalSelector = @selector(dataTaskWithRequest:completionHandler:); SEL…
Manu Gupta
  • 1,759
  • 1
  • 14
  • 22
1
vote
1 answer

Objective C - What is the difference between IMP and function pointer?

I recently started a project where I require to do swizzling. After going through many tutorials I got a question, What is the difference between Implementation and function pointer?
bikram990
  • 1,085
  • 1
  • 14
  • 36
1
vote
2 answers

recursive swizzling causes crash

I'm using DAKeyboardControll on my app . it has a method with name : swizzled_addSubview and implement Like this: - (void)swizzled_addSubview:(UIView *)subview { if (!subview.inputAccessoryView) { if ([subview isKindOfClass:[UITextField…
Mo Farhand
  • 1,144
  • 8
  • 21
1
vote
0 answers

Video playback Mirroring prevention workaround

Environment Xcode @ OS-X Yosemite iOS App @ Obj-C Use-case Quicktime mirroring session is set between the iOS & the OSX (How do I set up a mirroring session between iOS 8 and Yosemite? ) A 3rd party SDK is integrated with the iOS app The SDK is…
NadavRub
  • 2,520
  • 27
  • 63
1
vote
1 answer

ISA swizzling and calls to `super`

Assume the following class hierarchy. Class A is publicly declared: @interface A : NSObject + (A)createInstance; - (void)a; @end Class _B is a private subclass of A: @interface _B : A - (void)a; - (void)b; @end Assume objects of class A should…
Léo Natan
  • 56,823
  • 9
  • 150
  • 195
1
vote
0 answers

Restrict network access programmatically for the current app

Is it possible to swizzle or do something so that no part of the app, even static libraries can not make unwanted internet traffic (and still be approved by Apple reviewing process)? And if there is a way, please describe.
Bogus
  • 263
  • 1
  • 2
  • 11
1
vote
1 answer

Property of category class set in swizzled class method always returns nil

I wanted to create a category of UIImage class which will have its own handling of (UIImage*) imageNamed:(NSString*) name method which will save for me the name as a property of created image. In order to do so, I created a swizzle for this method…
1
vote
1 answer

Method Swizzling for UIView

I am following "This" guide. to capture UIView touchesBegan, but when I NSLog() touchesBegan in the UIViewController that this is for, it doesn't fire but does fire in the swizzled method. Is there a way I can have it fire in both?
George L
  • 1,673
  • 2
  • 26
  • 39
1
vote
2 answers

swizzling NSObject's performSelector:withObject: gives EXC_BAD_ACCESS why?

I'm trying to swizzle NSObject's performSelector:withObject: rentzsch's swizzling library, here is the code: #import "NSObject+xxxx.h" #import "JRSwizzle.h" @implementation NSObject (xxxx) + (void)load { static dispatch_once_t onceToken; …
subzero
  • 3,420
  • 5
  • 31
  • 40
1
vote
1 answer

glsl minus in swizzling

Can swizzling in GLSL somehow be with minus? For example: vec.-yx-wz The purpose for this is to get 2d normale with simple define: #DEFINE NORMALE_PACK(v) (v).-yx-wz #DEFINE NORMALE_1(v) dir.-yx #DEFINE NORMALE_2(v) vec.-wz void main(){ ...…
tower120
  • 5,007
  • 6
  • 40
  • 88
1
vote
1 answer

Swizzling NSBundle for reskinnable demo

I'm trying to build an application (not for app store distribution) that can be reskinned by downloading a bundle containing images and strings files. For localization, I've had no problems swizzling localizedStringForKey:value:table: to load my…
Tim
  • 4,560
  • 2
  • 40
  • 64
1
vote
2 answers

Thread-safety of method swizzling

Method swizzling is used in the following singleton initializer but i am not sure about thread safety of swizzling. What happens while a thread is about to call a method which is about to be swizzled by another method? Is it safe to swizzle in any…
lockedscope
  • 965
  • 17
  • 45
1
vote
1 answer

How to swizzle AudioSessionAddPropertyListener

There is a library in my project that is adding audio property listeners. I really need to be able to block it from doing so, but I don't have the source code. I've done a swizzle before for the addObserver method in NSNotificationCenter. Could you…
Gandalf458
  • 2,139
  • 1
  • 21
  • 36