Skip to content

Instantly share code, notes, and snippets.

@calebhicks
calebhicks / CoreDataHelper.m
Last active March 22, 2016 02:40
Core Data Helper
//
// CoreDataHelper.m
// Wired In
//
// Created by Caleb Hicks on 6/20/14.
//
// Readme: I use a version of this file in each Core Data project I create. It runs as a Shared Instance.
// Simply, it returns the default Managed Object Context for the app. Sample methods also provided to save, create sample
// data, and log all data within the app. Adjust the Imports and related methods for your model objects.
//
@calebhicks
calebhicks / Fetched Results Controller
Created July 23, 2014 01:36
Fetched Results Controller Boilerplate
- (NSFetchedResultsController *)fetchedResultsController
{
if (_fetchedResultsController != nil)
{
return _fetchedResultsController;
}
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Tag" inManagedObjectContext:[CoreDataHelper sharedInstance].managedObjectContext];
[fetchRequest setEntity:entity];
@calebhicks
calebhicks / parentTableView
Created July 23, 2014 19:34
Parent Table View of Custom TableViewCell
-(UITableView *) parentTableView {
// iterate up the view hierarchy to find the table containing this cell/view
UIView *aView = self.superview;
while(aView != nil) {
if([aView isKindOfClass:[UITableView class]]) {
return (UITableView *)aView;
}
aView = aView.superview;
}
@calebhicks
calebhicks / NTOnboardController.m
Last active August 29, 2015 14:04
Onboard Controller
//
// NTOnboardController.m
//
// Created by Caleb Hicks on 7/10/14.
//
// Readme: Subscribe to the notification for onboardedKey where you want to run something for onboarding.
// In your App Delegate or initial view controller, insantiate NTOnboardController and call -checkOnboarded.
// NTOnboardController will send the onboardedKey notification if the user has not been onboarded.
//
// Enjoy! Comment or @calebhicks with questions.
@calebhicks
calebhicks / ParseAccountViewController
Created July 30, 2014 05:37
Parse Login/Signup View Controller Sample
//
// WIAccountTableViewController.m
// Wired In
//
// Created by Caleb Hicks on 7/17/14.
// Copyright (c) 2014 We Are Wired In. All rights reserved.
//
#import "WIAccountTableViewController.h"
#import <Parse/Parse.h>
@calebhicks
calebhicks / image picker sample
Created September 6, 2014 17:54
image picker sample for ryan
// goes above interface and implementation
typedef NS_ENUM(NSInteger, ActionSheetButton){
ActionSheetFromLibrary,
ActionSheetTakePicture
};
#import <MobileCoreServices/MobileCoreServices.h>
// methods
@calebhicks
calebhicks / Settings.m
Created November 9, 2014 19:31
Sample Settings Class
//
// Settings.m
// Sample
//
// Created by Caleb Hicks on 7/2/14.
// Copyright (c) 2014 Caleb Hicks. All rights reserved.
//
#import "Settings.h"
@calebhicks
calebhicks / POTimer.h
Created January 21, 2015 02:55
POTimer
//
// POTimer.h
// Wired In
//
// Created by Caleb Hicks on 6/23/14.
// Copyright (c) 2014 Caleb Hicks. All rights reserved.
//
#import <Foundation/Foundation.h>
@calebhicks
calebhicks / ViewController.m
Created February 21, 2015 18:06
Using NSEnum to Label Sections
//
// ViewController.m
// UIColorCategory
//
// Created by Caleb Hicks on 2/21/15.
// Copyright (c) 2015 DevMountain. All rights reserved.
//
#import "ViewController.h"
@calebhicks
calebhicks / StorePurchaseController.h
Last active August 29, 2015 14:17
StorePurchaseController
//
// SSInAppPurchaseController.h
// SimpleStore
//
// Created by Joshua Howland on 7/2/14.
// Copyright (c) 2014 DevMountain. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>