Skip to content

Instantly share code, notes, and snippets.

View greggjaskiewicz's full-sized avatar
:shipit:
🦸🏼‍♂️

greg jaskiewicz greggjaskiewicz

:shipit:
🦸🏼‍♂️
View GitHub Profile
for element in cells {
    switch element {
    case .one(let typeOne):
        print("\(typeOne.bar1) \(typeOne.foo1) \(typeOne.foo2) ")
    case .two(let typeTwo):
        print("\(typeTwo.fooString) \(typeTwo.foo1) \(typeTwo.barBool) ")
    }
}
var cells: [OurStructs] = []
@greggjaskiewicz
greggjaskiewicz / twoStructs_Associated.swift
Created May 1, 2017 14:41
TwoStructsAssociated_AssociatedTypes
struct TypeOneStruct {
    let foo1: Int
    let foo2: Int
    let bar1: Bool
}
struct TypeTwoStruct {
    let fooString: String
    let barBool: Bool
    let foo1: Int
@greggjaskiewicz
greggjaskiewicz / twoStructAnyArray.swift
Created May 1, 2017 14:40
twoStructsAnyArray_associatedTypes
struct TypeOneStruct {
    let foo1: Int
    let foo2: Int
    let bar1: Bool
}
struct TypeTwoStruct {
    let fooString: String
    let barBool: Bool
    let foo1: Int
@greggjaskiewicz
greggjaskiewicz / twoStructs.swift
Created May 1, 2017 14:38
two structs_associated_types
struct TypeOneStruct {
    let foo1: Int
    let foo2: Int
    let bar1: Bool
}
struct TypeTwoStruct {
    let fooString: String
    let barBool: Bool
    let foo1: Int
let count = 15
let center = CGPoint(x: view.frame.width/2, y:view.frame.height/2)
button.center = center
let radius : CGFloat = 100
var angle = CGFloat(2 * M_PI)
for i in 1...count {
   let x = cos(angle) * radius + center.x
final class PulsateViewAnimator: NSObject {
   private weak var view: UIView?
   private var timer: Timer?
   private let breathOutDuration: TimeInterval
   private let holdDuration: TimeInterval
   private let breathInDuration: TimeInterval
   private let pulseScaleIdentity: CGAffineTransform
let button = UIButton(frame: CGRect(x: 75, y: 75, width: 100, height: 50))
button.backgroundColor = UIColor.green
button.setTitle("Boom Boom", for: .normal)
button.titleLabel?.textColor = UIColor.black
let view = UIView(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
PlaygroundPage.current.liveView = view
view.addSubview(button)
final class PulsatingButton: UIButton {
   private var timer: Timer?
   func setup() {
       self.layer.shouldRasterize = true
       self.timer = Timer.scheduledTimer(timeInterval: 5.0, target: self, selector: #selector(timerAction), userInfo: nil, repeats: true)
   }
   private let buttonScaleIdentity = CGAffineTransform.init(scaleX: 1.75, y: 1.75)
final class PulsatingButtonViewController: UIViewController {
private var button: UIButton?
private var timer: Timer?
override func viewDidLoad() {
super.viewDidLoad()
self.button = UIButton(frame: CGRect(x: 250, y: 250, width: 100, height: 50))
if let button = self.button {