This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Playground - noun: a place where people can play | |
import UIKit | |
import QuartzCore | |
var str = "Hello, playground" | |
var nums = [1, 3, 5, 7, 9, 11, 13] | |
var count = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AltitudeViewController.swift | |
// Altitudes | |
// | |
// Created by Taylor Franklin on 10/22/14. | |
// | |
import UIKit | |
import CoreMotion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// PixelViewController.swift | |
// | |
// Created by Taylor Franklin | |
// | |
import UIKit | |
class PixelViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Method that returns a slightly lighter color than the one passed in | |
/// | |
/// :param: color color is the color we want to make ligter | |
/// :returns: The lighter color | |
func lighterColorForColor(color: UIColor) -> UIColor { | |
var r:CGFloat = 0, g:CGFloat = 0, b:CGFloat = 0, a: CGFloat = 0 | |
if color.getRed(&r, green: &g, blue: &b, alpha: &a) { | |
return UIColor(red: min(r + colorShadeDifference, 1.0), green: min(g + colorShadeDifference, 1.0), blue: min(b + colorShadeDifference, 1.0), alpha: a) | |
} | |
return color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The following two functions are based on: https://dev.twitter.com/docs/ios/making-api-requests-slrequest | |
func userHasAccessToTwitter() -> Bool { | |
return SLComposeViewController.isAvailableForServiceType(SLServiceTypeTwitter) | |
} | |
func fetchTimelineForUser(username: String) { | |
if userHasAccessToTwitter() { | |
var twitterAccountType: ACAccountType = self.accountStore.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierTwitter) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { | |
// Override point for customization after application launch. | |
self.window = UIWindow(frame: UIScreen.mainScreen().bounds) | |
var nav1 = UINavigationController() | |
var first = FirstViewController(nibName: nil, bundle: nil) | |
nav1.viewControllers = [first] | |
var second = SecondViewController(nibName: nil, bundle: nil) | |
var nav2 = UINavigationController() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Not full implementation for UIActionSheet, check out my blog for more details: http://cleancrispcode.wordpress.com/ | |
// shareTitles array created in viewDidLoad | |
NSArray *shareTitles = @[NSLocalizedString(@"Facebook", nil), NSLocalizedString(@"Twitter", nil)]; | |
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex | |
{ | |
NSString *buttonTitle = [actionSheet buttonTitleAtIndex:buttonIndex]; | |
if ([buttonTitle isEqualToString:shareTitles[0]]) |