Skip to content

Instantly share code, notes, and snippets.

View dillon-mce's full-sized avatar

Dillon McElhinney dillon-mce

View GitHub Profile
@dillon-mce
dillon-mce / handleRouteChange.swift
Last active February 6, 2024 15:39
Handling Audio Route Changes
#import AVFoundation
// Observe the route change notification
NotificationCenter.default.addObserver(
self,
selector: #selector(handleRouteChange),
name: AVAudioSession.routeChangeNotification,
object: AVAudioSession.sharedInstance()
)
@dillon-mce
dillon-mce / GradientView.swift
Created June 20, 2019 00:20
A Simple Gradient View Snippet
import UIKit
class GradientView: UIView {
override class var layerClass: AnyClass {
return CAGradientLayer.self
}
override init(frame: CGRect) {
super.init(frame: frame)
setupGradient()