Skip to content

Instantly share code, notes, and snippets.

View KyleGoslan's full-sized avatar

Kyle Goslan KyleGoslan

View GitHub Profile
@KyleGoslan
KyleGoslan / UIView+Extension.swift
Last active August 9, 2023 08:47
UIView extension to easily add and remove a blur (UIVisualEffectView)
import UIKit
extension UIView {
func blurView(style: UIBlurEffect.Style) {
var blurEffectView = UIVisualEffectView()
let blurEffect = UIBlurEffect(style: style)
blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = bounds
addSubview(blurEffectView)
}
@KyleGoslan
KyleGoslan / AnimateMapCamera.swift
Last active March 21, 2016 00:06
Animate MKMapCamera in Swift 2
//Create a new MKMapCamera object.
//Looking at, is where you want it to look at, in this example I keep it the same so use the map views current center coordinate
//I up the altitude (zoom out) by adding 1600 on to the current position
//Pitch and heading are the rotation and angle of the camera
let newCameraPosition = MKMapCamera(lookingAtCenterCoordinate: mapView.centerCoordinate, fromDistance: mapView.camera.altitude + 1600, pitch: 50, heading: -30)
//Animate the camera, here over 5 seconds with a 1.5 second delay, the options are fairly self explanitory.
UIView.animateWithDuration(5, delay: 1.5, options: [.AllowUserInteraction, .CurveEaseInOut], animations: {