kiwi-bdd / Kiwi

Simple BDD for iOS
BSD 3-Clause "New" or "Revised" License
4.14k stars 512 forks source link

Removes duplicate of captureArgument #718

Closed mugx-fc closed 4 years ago

mugx-fc commented 4 years ago

Problem

On compiling the framework with Xcode 11, I've got the following warnings:

Screenshot 2020-01-31 at 10 59 05

The problem is that the function captureArgument:atIndex: is defined in both KiwiSpyAdditions and KiwiStubAdditions additions:

@protocol KiwiSpyAdditions <NSObject>
- (KWCaptureSpy *)captureArgument:(SEL)selector atIndex:(NSUInteger)index;
+ (KWCaptureSpy *)captureArgument:(SEL)selector atIndex:(NSUInteger)index;
@end

@interface NSObject (KiwiSpyAdditions) <KiwiSpyAdditions>
@protocol KiwiStubAdditions <NSObject>
- (KWCaptureSpy *)captureArgument:(SEL)selector atIndex:(NSUInteger)index;
+ (KWCaptureSpy *)captureArgument:(SEL)selector atIndex:(NSUInteger)index;
@end

@interface NSObject(KiwiStubAdditions) <KiwiStubAdditions>

Solution

This PR removes the duplicated captureArgument:atIndex: (both class and instance) methods from KiwiStubAdditions, which were added in the following commit: https://github.com/kiwi-bdd/Kiwi/commit/592b25a8f7d7cb0c67b4b685366fd482be8b8492#diff-a7e330fecdc419920d8bf144bf9fc881

If needed, It's enough to import Kiwi.h to be able to access to captureArgument:atIndex: because all the NSObject categories are already being imported (including NSObject+KiwiSpyAdditions.h):

Screenshot 2020-01-31 at 11 09 27


Please note that the implementation of captureArgument:atIndex: from NSObject+KiwiSpyAdditions.h and NSObject+KiwiStubAdditions.h are exactly the same, so it won't generate any breaking changes to the external projects. They are both categories of the same NSObject.

ecaselles commented 4 years ago

Thanks for your help @mugx-fc. It would be great if you could describe briefly the issue being resolved by this PR and your solution, for future reference.