Created
April 19, 2019 13:10
-
-
Save amichnia/37c2ede1e55c8f5d9dfc89c4a6b885b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AdditionFrameworkInterop.m | |
#import "AdditionFrameworkInterop.h" | |
@import AdditionalSDK; | |
// You can adopt protocols from additional framework even if its weak linked | |
@interface AdditionFrameworkInterop() <PrimeNumberCheckerDelegate> | |
@property (strong, nonatomic) PrimeNumberChecker *primeChecker; | |
@end | |
@implementation AdditionFrameworkInterop | |
+ (BOOL)additionalModuleAvailable { | |
// ... | |
} | |
- (instancetype)init { | |
self = [super init]; | |
if (self && [AdditionFrameworkInterop additionalModuleAvailable]) { | |
_primeChecker = [[PrimeNumberChecker alloc] init]; | |
[_primeChecker setDelegate:self]; | |
} | |
return self; | |
} | |
- (void)inspectWithNumber:(NSInteger)number { | |
if ([AdditionFrameworkInterop additionalModuleAvailable]) { | |
[_primeChecker inspectWithNumber:number]; | |
} | |
} | |
- (void)didFinishInspectingWithNumber:(NSInteger)number isPrime:(BOOL)isPrime { | |
[_delegate didFinishInspectingWithNumber:number isPrime:isPrime]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment