Skip to content

Instantly share code, notes, and snippets.

View tfrank64's full-sized avatar

Taylor Franklin tfrank64

View GitHub Profile
@tfrank64
tfrank64 / education.swift
Last active August 29, 2015 14:12
Example playground to show off the visualzations you can get with Swift playgrounds.
// 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
@tfrank64
tfrank64 / AltitudeViewController.swift
Last active June 25, 2018 23:56
Retrieving data for relative altitude and air pressure with CMAltimeter
//
// AltitudeViewController.swift
// Altitudes
//
// Created by Taylor Franklin on 10/22/14.
//
import UIKit
import CoreMotion
@tfrank64
tfrank64 / PixelViewController.swift
Last active May 11, 2016 11:46
UI experiment using CRPixellatedView and the basic layout of MGSpotyViewController
//
// PixelViewController.swift
//
// Created by Taylor Franklin
//
import UIKit
class PixelViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
/// 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
@tfrank64
tfrank64 / swiftTwitter.swift
Created July 11, 2014 15:59
Swift API Requests with SLRequest
// 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)
@tfrank64
tfrank64 / AppDelegate.swift
Created June 8, 2014 17:32
Swift UITabBar Programmatically
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()
@tfrank64
tfrank64 / sharing.m
Created March 7, 2014 00:58
Native iOS7 Sharing Dialogs
// 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]])