Skip to content

Instantly share code, notes, and snippets.

View Adnan1990's full-sized avatar

Muhammad Adnan Adnan1990

View GitHub Profile
@Adnan1990
Adnan1990 / SelfSizedTableView.swift
Created August 16, 2021 12:47 — forked from db42/SelfSizedTableView.swift
Swift 4 recipe: Self sizing table view
//
// SelfSizedTableView.swift
// AdjustableTableView
//
// Created by Dushyant Bansal on 25/02/18.
// Copyright © 2018 db42.in. All rights reserved.
//
import UIKit
func renameFile(oldName:String , newName : String){
do {
let originPath = (self.getDirectoryPath() as NSString).appendingPathComponent(oldName)
let destinationPath = (self.getDirectoryPath() as NSString).appendingPathComponent(newName)
try FileManager.default.moveItem(at: URL(fileURLWithPath: originPath), to: URL(fileURLWithPath: destinationPath))
} catch {
@Adnan1990
Adnan1990 / FabricPermission
Last active September 8, 2019 09:26
/Fabric.framework/run: Permission denied
Open terminal and in your project go to the folder where fabric framework exist.if you are using pods then fabric will be inside pod folder.
Run below commands in terminal once you have reached the folder path to fabric
sudo chmod 777 run
sudo chmod 777 uploadDSYM
//Generic to swap values of two variables regardless of their data type
func genericSwap<T>(inout a:T,inout b: T)
{
let temp = a
a = b
b = temp
}
//Trigger observer to perform UI update like refresh listing in App
dispatch_async(dispatch_get_main_queue(), ^(void) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"productListUpdatedWithProductsList" object:nil];
});
//Adding observer in listner Class in ViewDidLoad()
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadFriendRequestSent) name:@"productListUpdatedWithProductsList" object:nil];
@Adnan1990
Adnan1990 / CustomTextField.h
Created December 16, 2015 05:20
Customizing TextField Placeholder
//
// CustomTextField.h
// LMKT
//
// Created by Adnan on 12/15/15.
//
//
#import <UIKit/UIKit.h>
@Adnan1990
Adnan1990 / Sift+objective c Awesome.
Created August 26, 2015 05:45
Swift and objective c resources
Collaborative List of Open-Source iOS Apps
https://github.com/dkhamsing/open-source-ios-apps#official
awesome swift
https://github.com/matteocrippa/awesome-swift
Awesome IOS
https://github.com/vsouza/awesome-ios
@Adnan1990
Adnan1990 / imageReadWrite.m
Last active August 29, 2015 14:22
Saving and retrieving images to or from document directory
//The following function saves UIImage in test.png file in the user Document folder:
- (void)saveImage: (UIImage*)image
{
if (image != nil)
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString* path = [documentsDirectory stringByAppendingPathComponent:
#import <Foundation/Foundation.h>
@interface MyCalendar : NSObject
+ (void)requestAccess:(void (^)(BOOL granted, NSError *error))success;
+ (BOOL)addEventAt:(NSDate*)eventDate withTitle:(NSString*)title inLocation:(NSString*)location;
@end
//Disabling ios cache and getting remote data
[[NSURLCache sharedURLCache] removeAllCachedResponses];