Skip to content

Instantly share code, notes, and snippets.

@alexpaul
Last active May 26, 2018 23:17
Show Gist options
  • Save alexpaul/a386f19fc583a2f1045df91e0551b2eb to your computer and use it in GitHub Desktop.
Save alexpaul/a386f19fc583a2f1045df91e0551b2eb to your computer and use it in GitHub Desktop.
//
// UIViewController+Additions.h
// Events
//
// Created by Alex Paul on 5/26/18.
// Copyright © 2018 Alex Paul. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIViewController (Additions)
- (void)showAlertWithTitle:(NSString *)title andMessage:(NSString *)message;
- (void)showAcitivityControllerWithURLLink:(NSString *)urlLink;
@end
//
// UIViewController+Additions.m
// Events
//
// Created by Alex Paul on 5/26/18.
// Copyright © 2018 Alex Paul. All rights reserved.
//
#import "UIViewController+Additions.h"
@implementation UIViewController (Alerts)
- (void)showAlertWithTitle:(NSString *)title andMessage:(NSString *)message {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
}
- (void)showAcitivityControllerWithURLLink:(NSString *)urlLink {
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:@[urlLink] applicationActivities:nil];
[self presentViewController:activityController animated:YES completion:nil];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment