Skip to content

Instantly share code, notes, and snippets.

View amitpdev's full-sized avatar

Amit Palomo amitpdev

View GitHub Profile
@alexandreraulin
alexandreraulin / gist:f4b1504aec9d25f5af08
Last active June 20, 2019 09:03
Script for iOS Universal Framework compilation with Xcode 6
# This script is based on Jacob Van Order's answer on apple dev forums https://devforums.apple.com/message/971277
# See also http://spin.atomicobject.com/2011/12/13/building-a-universal-framework-for-ios/ for the start
# To get this to work with a Xcode 6 Cocoa Touch Framework, create Framework
# Then create a new Aggregate Target. Throw this script into a Build Script Phrase on the Aggregate
######################
# Options
@nvkiet
nvkiet / [Swift] Switch-RootViewController
Last active January 28, 2025 07:46
Switch root view controller
func switchRootViewController(rootViewController: UIViewController, animated: Bool, completion: (() -> Void)?) {
if animated {
UIView.transitionWithView(window, duration: 0.5, options: .TransitionCrossDissolve, animations: {
let oldState: Bool = UIView.areAnimationsEnabled()
UIView.setAnimationsEnabled(false)
self.window!.rootViewController = rootViewController
UIView.setAnimationsEnabled(oldState)
}, completion: { (finished: Bool) -> () in
if completion {
completion!()
@asmallteapot
asmallteapot / .gitattributes
Last active September 15, 2024 12:58
Diff Xcode localizable strings files in Git.
*.strings utf16 diff=localizablestrings
@mx4492
mx4492 / recursive-blocks.m
Last active April 13, 2022 16:21
Recursive Blocks in Objective C (under ARC)
#include <stdio.h>
/**
This only works if the block in question is called synchronously.
*/
void try0() {
typedef void(^RecursiveBlock)();
__block int i = 5;
@rafi
rafi / INSTALL.md
Last active December 30, 2015 20:19
My Arch Linux installation
- (void) keyboardWillHide:(NSNotification *)nsNotification {
NSDictionary * userInfo = [nsNotification userInfo];
CGSize kbSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGRect newFrame = [tableframe];
CGFloat kHeight = kbSize.height;
if(UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)){
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a" &&
DEVICE_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a" &&
UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/${CONFIGURATION}-iphoneuniversal" &&
UNIVERSAL_LIBRARY_PATH="${UNIVERSAL_LIBRARY_DIR}/${PRODUCT_NAME}" &&
FRAMEWORK="${UNIVERSAL_LIBRARY_DIR}/${PRODUCT_NAME}.framework" &&
# Create framework directory structure.
rm -rf "${FRAMEWORK}" &&
mkdir -p "${UNIVERSAL_LIBRARY_DIR}" &&
mkdir -p "${FRAMEWORK}/Versions/A/Headers" &&