Skip to content

Instantly share code, notes, and snippets.

let someDate = NSDate()
let tomorrow = NSCalendar.currentCalendar().dateByAddingUnit(NSCalendarUnit.CalendarUnitDay, value: 18, toDate: someDate, options: nil)
//
// ViewController.swift
// AllredTube
//
// Created by Nick Walter on 6/29/15.
// Copyright (c) 2015 Nick Walter. All rights reserved.
//
import UIKit
@nwalter08
nwalter08 / gist:8288868
Created January 6, 2014 19:59
BYU Cocoaheads January Meeting blurb
Happy new year! Hope you all had a great holiday. For January's meeting were are going to have an open discussion. This is something we are trying out that our SLC Cocoaheads friends do occasionally. Feel free to bring something you want to present like an app your working on or a new framework that you like. We'd also like to have some discussion on topics you're interested in. These could be anything from AppCode vs. Xcode, when to use singletons, etc. We will be meeting in room ## of the Tanner Building on BYU campus. Here is link to the facebook event.
Hope to see you all there and please respond back with any questions!
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd"];
NSString *stringFromDate = [formatter stringFromDate:thumbnailBodyPic.date];
+ (id)sharedInstance {
static API *sharedMyManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedMyManager = [[self alloc] init];
});
return sharedMyManager;
}
//
// ViewController.m
// fixtestingthing
//
// Created by Nick Walter on 10/31/13.
// Copyright (c) 2013 Nikki. All rights reserved.
//
#import "ViewController.h"
- (IBAction)sendTapped {
ToDo *toDo = [[ToDo alloc] init];
toDo.task = self.taskTextField.text;
toDo.taskDescription = self.descriptionTextView.text;
// Not sure how in the data model we want to handle this but you can get sender email below
// self.toComposeView.toTextField.text
}
// Calculate the size of the tableView if it were to be dispalyed
[self.tableView layoutIfNeeded];
// If the conent of the tableView is too small to scroll past the search bar...
if (self.tableView.contentSize.height < self.tableView.frame.size.height) {
// Add the difference and the height of the serachBarView to the bottom of the contentSize
CGFloat diff = self.tableView.frame.size.height - self.tableView.contentSize.height;
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, (diff + 44), 0);
}
// Scroll to the first section and the first row of the tableView
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];