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
// | |
// AppDelegate.swift | |
// Hypnosister3 | |
// | |
// Created by John Regner on 8/23/14. | |
// Copyright (c) 2014 In Your Dreams Software. All rights reserved. | |
// | |
import UIKit |
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
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow! | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
window = UIWindow(frame: UIScreen.mainScreen().bounds) | |
let dev = UIDevice.currentDevice() | |
dev.beginGeneratingDeviceOrientationNotifications() |
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
import UIKit | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
ErrorView.errorInView(self.view, animated: true) | |
} | |
} |
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
// | |
// ViewController.swift | |
// error-view | |
// | |
// Created by John Regner on 11/1/14. | |
// Copyright (c) 2014 In Your Dreams Software. All rights reserved. | |
// | |
import UIKit |
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
// | |
// pictPopBGView.swift | |
// | |
import UIKit | |
class pictPopBGView: UIPopoverBackgroundView { | |
override var arrowOffset: CGFloat { | |
get{ |
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
//Class methods and initializers that satisfy protocol requirements now properly invoke subclass | |
//overrides when called in generic contexts. (18828217) For example: | |
protocol P { | |
class func foo() | |
} | |
class C: P { | |
class func foo() { println("C!") } | |
} |
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
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext | |
{ | |
// Get transition context views and things | |
UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; | |
UIView *fromView = fromVC.view; | |
UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; | |
UIView *toView = toVC.view; | |
//here is where you do the transition |
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
import Swift | |
import Foundation | |
// convert input Collection<T> into an NSMutableArray<NSData> | |
// works with Array<T>, Set<T>, Dictionary<T,U> | |
func convertCollectionToArrayOfData<T: CollectionType>(collection: T) -> NSMutableArray { | |
return NSMutableArray(array: map(collection){ | |
var mutableItem = $0 | |
return NSData(bytes: &mutableItem, length: sizeof(T.Generator.Element.self)) | |
}) |
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
/// A function for calculating the time in 0.1 hour increments | |
/// i.e. 1 hour and 6 min is 1.1hours, 3 hours 12 minutes is 3.2 hours | |
func calc(hours: Int, min: Int) -> Double { | |
let dbl = Double(min) | |
let roundedMin = (dbl / 60.0) | |
let flr = floor(roundedMin * 10 ) / 10 | |
return Double(hours) + floor(roundedMin * 10) / 10 | |
} | |
/// How to round a number? |
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
//Turns out in swift Bool is a struct! | |
/// From the Docs. `import Swift` | |
/// A value type whose instances are either `true` or `false`. | |
struct Bool { | |
/// Default-initialize Boolean value to `false`. | |
init() | |
} |