Created
March 28, 2018 12:51
-
-
Save bagpack/b4ffacb676daef310e5be6a799d6f2d0 to your computer and use it in GitHub Desktop.
UIActivity with WhiteList
This file contains hidden or 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
#import <UIKit/UIKit.h> | |
#ifndef ActivityViewController_h | |
#define ActivityViewController_h | |
@interface UIActivityViewController (Private) | |
- (BOOL)_shouldExcludeActivityType:(UIActivity*)activity; | |
@end | |
@interface ActivityViewController : UIActivityViewController | |
@end | |
#endif /* ActivityViewController_h */ |
This file contains hidden or 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
#import "ActivityViewController.h" | |
@implementation ActivityViewController | |
@end |
This file contains hidden or 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
#import "ActivityViewController.h" |
This file contains hidden or 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
import UIKit | |
class MyActivityViewController: ActivityViewController { | |
override func _shouldExcludeActivityType(_ activity: UIActivity!) -> Bool { | |
let activityTypeWhiteList: [UIActivityType] = [ | |
UIActivityType.postToTwitter, | |
UIActivityType.postToFacebook | |
] | |
guard let activityType = activity.activityType else { | |
return true | |
} | |
return !activityTypeWhiteList.contains(activityType) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment