2

Something like this ?

^void (__unsafe_unretained UIViewController self, UIScrollView *scrollView, CGPoint velocity, inout CGPoint *targetContentOffset){
    // Something
}

or whats the alternative to using such paramrters.

Context:

I am trying to swizzle the scrollViewWillEndDragging:withVelocity:targetContentOffset: method of the UIScrollviewDelegate but the last parameter targetContentOffset is an inout parameter. I am using https://github.com/JonasGessner/JGMethodSwizzler to swizzle the instances which expects a block to be used as a replacement method.

Code which I am trying to use...

[scrollViewDelegateObj swizzleMethod:@selector(scrollViewWillEndDragging:withVelocity:targetContentOffset:) withReplacement:^id(JG_IMP original, __unsafe_unretained Class swizzledClass, SEL selector) {
        return JGMethodReplacement(void, UIViewController *, UIScrollView *scrollView, CGPoint velocity, CGPoint *targetContentOffset){
            JGOriginalImplementation(void, scrollView, velocity, targetContentOffset);

    };
}];

Can anyone help me out ?

mohkhan
  • 11,925
  • 2
  • 24
  • 27

0 Answers0