Skip to content

Instantly share code, notes, and snippets.

View regnerjr's full-sized avatar

John Regner regnerjr

View GitHub Profile
@regnerjr
regnerjr / Chapter 4
Created August 15, 2014 02:38
Chapter 4 - BNR iOS Programming - Swift
//
// ViewController.swift
// WhereAmI
//
// Created by John Regner on 8/13/14.
// Copyright (c) 2014 In Your Dreams Software. All rights reserved.
//
import UIKit
import CoreLocation
//
// ViewController.swift
// WhereAmI
//
// Created by John Regner on 8/13/14.
// Copyright (c) 2014 In Your Dreams Software. All rights reserved.
//
import UIKit
import CoreLocation
@regnerjr
regnerjr / Chapter4-WithChallenges
Created August 27, 2014 00:55
Chapter 4 - BNR iOS Programming - Swift
//
// ViewController.swift
// WhereAmI
//
// Created by John Regner on 8/13/14.
// Copyright (c) 2014 In Your Dreams Software. All rights reserved.
//
import UIKit
import CoreLocation
@regnerjr
regnerjr / ch6UIViews.swift
Created August 30, 2014 17:13
BNR Chapter 6 - UIViews and Quartz Drawing
//
// AppDelegate.swift
// Hypnosister3
//
// Created by John Regner on 8/23/14.
// Copyright (c) 2014 In Your Dreams Software. All rights reserved.
//
import UIKit
@regnerjr
regnerjr / SwiftNotifications.swift
Created September 7, 2014 17:31
Handling Notifications in Swift
@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()
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
ErrorView.errorInView(self.view, animated: true)
}
}
//
// ViewController.swift
// error-view
//
// Created by John Regner on 11/1/14.
// Copyright (c) 2014 In Your Dreams Software. All rights reserved.
//
import UIKit
@regnerjr
regnerjr / pictPopBGView.swift
Created November 9, 2014 18:01
A custom PopoverBackgroundView - Which does not work. Errors is EXC_BAD_ACCESS when trying to access the arrowOffset or arrowDirection.
//
// pictPopBGView.swift
//
import UIKit
class pictPopBGView: UIPopoverBackgroundView {
override var arrowOffset: CGFloat {
get{
@regnerjr
regnerjr / gist:27b74811ce690021f27b
Created November 14, 2014 21:33
Horray Fixed in Xcode 6.1.1
//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!") }
}
@regnerjr
regnerjr / gist:6960525a154671b76882
Last active August 29, 2015 14:15
animateTransition, Top and bottom halves slide to reveal next view underneath.
- (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