Skip to content

Instantly share code, notes, and snippets.

View ChristianVinterly's full-sized avatar

Christian Vinterly ChristianVinterly

View GitHub Profile
@ChristianVinterly
ChristianVinterly / ParallaxFun.swft
Last active July 13, 2017 09:40
Fun with MotionEffect
func addParallaxMotionEffects(tiltValue: CGFloat = 0.25, panValue: CGFloat = 5) {
var xTilt = UIInterpolatingMotionEffect()
var yTilt = UIInterpolatingMotionEffect()
var xPan = UIInterpolatingMotionEffect()
var yPan = UIInterpolatingMotionEffect()
let motionGroup = UIMotionEffectGroup()
xTilt = UIInterpolatingMotionEffect(
keyPath: "layer.transform.rotation.y",
type: .tiltAlongHorizontalAxis
@ChristianVinterly
ChristianVinterly / Observers.swift
Last active July 12, 2017 15:15
Alternative observer pattern in swift, with playground example
//: Playground - noun: a place where people can play
import UIKit
private class Weak: Hashable {
let hashValue: Int
weak var value: AnyObject?
init(value: AnyObject) {
self.value = value
self.hashValue = ObjectIdentifier(value).hashValue

Keybase proof

I hereby claim:

  • I am christianlysne on github.
  • I am lysne (https://keybase.io/lysne) on keybase.
  • I have a public key whose fingerprint is 3745 D816 85DF 7F7E C855 9BFB 71E9 E38A 6BE3 704E

To claim this, I am signing this object: