Skip to content

Instantly share code, notes, and snippets.

@matteodanelli
Created January 9, 2018 15:12

Revisions

  1. matteodanelli created this gist Jan 9, 2018.
    9 changes: 9 additions & 0 deletions selectors.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    fileprivate extension Selector {
    static let buttonTapped = #selector(ViewController.buttonTapped)
    static let deviceOrientationDidChange = #selector(ViewController.deviceOrientationDidChange)
    }

    // Example on how to use it
    NotificationCenter.default.addObserver(self, selector: .deviceOrientationDidChange,
    name: NSNotification.Name.UIDeviceOrientationDidChange,
    object: nil)