Skip to content

Instantly share code, notes, and snippets.

@SmatchyLaPaglia
SmatchyLaPaglia / BlurVCPageController.swift
Last active October 22, 2016 01:53
A Playground demonstrating a UIViewPageController that presents pages as rounded-rect UIBurEffect views. Does most of the work of configuring itself, you just have to give it a frame and closures that generate the views for each page. Some of the code uses extensions that aren't included in this file, but it will be obvious by the error messages…
import UIKit
import Foundation
import XCPlayground
/** A ViewController with a blurView in the middle.*/
public class BlurVC: UIViewController {
//properties
/** Used by BlurVCPageController to identify the index of the viewMaker for this BlurVC. (read-only)*/
private(set) var indexInPageController: Int?
/** The inset rounded rect with a UIBlurEffect in which the page's content should be drawn. */
@SmatchyLaPaglia
SmatchyLaPaglia / ViewSpec.swift
Last active October 17, 2016 14:10
A Swift 2 XCode Playground demonstrating the ViewSpec protocol for rapidly generating UI elements. Uses some custom extensions that are not included, so almost certainly won't run in a standard Playground. Also requires an image named "puppy1.jpg" to be in the Resources folder.
//: [Previous](@previous)
import Foundation
import XCPlayground
import UIKit
let liveVC = UIViewController()
XCPlaygroundPage.currentPage.liveView = liveVC
/** View specification protocol. Can be used to create a UIView that has the given specs.*/
public protocol ViewSpec {