Skip to content

Instantly share code, notes, and snippets.

View Adnan1990's full-sized avatar

Muhammad Adnan Adnan1990

View GitHub Profile
//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];
//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
}
@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
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 / 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