Skip to content

Instantly share code, notes, and snippets.

View verma-manish58's full-sized avatar

Manish Verma verma-manish58

View GitHub Profile
extension NSObject {
/**
* ASSOCIATED - OBJECTS
*/
public func associate(value: AnyObject, withKey: String) {
objc_setAssociatedObject(self, withKey, value, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
public func getAssociatedValue(key: String) -> AnyObject {
//
// NSObject+AssociatedObject.h
// OCLearning
//
// Created by Manish Verma on 26/07/16.
// Copyright © 2016 Manish Verma. All rights reserved.
//
#import <Foundation/Foundation.h>
//
// ViewController+Tracking.h
// OCLearning
//
// Created by Manish Verma on 26/07/16.
// Copyright © 2016 Manish Verma. All rights reserved.
//
#import "ViewController.h"
@verma-manish58
verma-manish58 / UIActivityViewController.md
Created October 29, 2015 17:26 — forked from JeOam/UIActivityViewController.md
UIActivityViewController tips
NSString *string = @"Text to share"
UIImage *image = [UIImage imageNamed:@"imageToShare"];
NSURL *URL = [NSURL URLWithString:@"relativeUrl"];

// Integrate with WeChat
NSArray *activity = @[[[WeixinSessionActivity alloc] init], [[WeixinTimelineActivity alloc] init]];

UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[string, image, URL] applicationActivities:activity];
[self.navigationController presentViewController:activityViewController animated:YES completion:nil];
- (IBAction)shareInstagramClicked:(id)sender
{
//Instagram URL Scheme
NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL])
{
NSString *message = @"";
NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
@verma-manish58
verma-manish58 / NSData+AESCrypt.h
Last active August 29, 2015 14:26 — forked from Harinder/NSData+AESCrypt.h
Adding methods to NSData and NSString using categories to provide AES256 encryption on iOS
//
// NSData+AESCrypt.h
//
// AES Encrypt/Decrypt
// Created by Jim Dovey and 'Jean'
// See http://iphonedevelopment.blogspot.com/2009/02/strong-encryption-for-cocoa-cocoa-touch.html
//
// BASE64 Encoding/Decoding
// Copyright (c) 2001 Kyle Hammond. All rights reserved.
// Original development by Dave Winer.