Skip to content

Instantly share code, notes, and snippets.

@marcboeren
marcboeren / 1.postToIp.swift
Created March 19, 2015 22:43
Use Alamofire & SwiftyJSON to POST to a JSON API, retry every second unless cancelled or successful
import Alamofire
class Something {
var postCancelled: Bool = false
func postToIp(ip: String) {
let parameters = [
"a": "value 1",
@marcboeren
marcboeren / 1.UIStoryboardSegueFromRight.swift
Created March 19, 2015 20:02
Segue from Right (Slide the next controllers view in from right to left (and back))
import UIKit
class UIStoryboardSegueFromRight: UIStoryboardSegue {
override func perform()
{
let src = self.sourceViewController as UIViewController
let dst = self.destinationViewController as UIViewController
src.view.superview?.insertSubview(dst.view, aboveSubview: src.view)
@marcboeren
marcboeren / gist:46749b21897fa1a90a12
Created March 19, 2015 19:53
Three blinking lights (chained animated UIImageViews).
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var light1: UIImageView!
@IBOutlet weak var light2: UIImageView!
@IBOutlet weak var light3: UIImageView!
enum BlinkingStatus {
case Blinking, Off