Skip to content

Instantly share code, notes, and snippets.

View iggym's full-sized avatar
🎯
😄

Iggy iggym

🎯
😄
View GitHub Profile
@iggym
iggym / SCM_Status_in_Xcode
Created June 18, 2013 22:28
SCM Status in Xcode
Keep Track of Your Files’ SCM Status
You can keep track of your files’ SCM status in the project navigator. SCM status is shown as a badge next to the file name as follows:
Badge SCM status
M Locally modified
U Updated in repository
A Locally added
@iggym
iggym / gist:5822555
Last active December 17, 2018 15:41
initialize a view controller with nib or storyboard
//To initialize a view controller with a nib file you use initWithNibName.
UIViewController *viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
//Using Storyboard instead of nib files, use the UIStoryboard class
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MyStoryboard" bundle:nil];
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
@iggym
iggym / Using_Remote_Git_Repo
Last active December 18, 2015 19:38
Using a remote git repo
//Go to the directory containing your project.
cd <directory of your Xcode project>
//If you already have a local git project, skip the steps below
git init .
git add .
git commit -s <type in a commit message>
//Push into your repository. --Push an existing repository from the command line
@iggym
iggym / gist:5845490
Created June 23, 2013 15:54
Useful iOS Project structure
Useful iOS Project structure
A simple folder structure:
AppDelegate
Controllers
Models
Helpers
Folder Structure for a complex app
@iggym
iggym / gist:5876748
Last active May 30, 2020 00:47
Random number generation in objective-c
#include <stdlib.h>
int r = arc4random() % 74;
arc4random_uniform(74)
//Use the arc4random_uniform(upper_bound) function to generate a random number within a range.
//The following will generate a number between 0 and 73 inclusive.
arc4random_uniform(74)
@iggym
iggym / gist:5888100
Created June 28, 2013 21:04
UITextField validation
//This will check a UITextField for a proper email and phone number of 10 digits or less.
//Add this method to the textFields delegate then check if the characters it is about to change should be added or not.
//Return YES or NO depending on the text field, how many characters are currently in it, and what characters it wants to add:
#define ALPHA @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
#define NUMERIC @"1234567890"
#define ALPHA_NUMERIC ALPHA NUMERIC
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
NSCharacterSet *unacceptedInput = nil;
@iggym
iggym / gist:5892324
Last active December 19, 2015 03:48
Getting Current Time in string in Custom format in objective c
NSDateFormatter *formatter;
NSString *dateString;
formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"dd-MM-yyyy HH:mm"];
dateString = [formatter stringFromDate:[NSDate date]];
@iggym
iggym / gist:5936542
Created July 5, 2013 19:02
Installing Credential Helper for OS X
To avoid always entering your login credentials and generating SSH keys, you'll want to install the credential helper so your passwords are cached. On OS X, you'll need to handle this through the Terminal. To start, use this command to download the credential helper:
//Get the helper
curl -s -O \
http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain
//change permissions
chmod u+x git-credential-osxkeychain
@iggym
iggym / gist:5950905
Created July 8, 2013 17:48
Template for README.md
Master-Detail App Template
=====================
A Master-Detail App Template from Xcode
Overview
--------
- version: 0.1.0
Description
@iggym
iggym / Github and related Links
Last active December 19, 2015 12:08
Useful Links for Working on and with git, github