Skip to content

Instantly share code, notes, and snippets.

@keith
Created June 25, 2015 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keith/ed925987ad63638e89ca to your computer and use it in GitHub Desktop.
Save keith/ed925987ad63638e89ca to your computer and use it in GitHub Desktop.
Overriding Extensions bug fixed in Swift 2.0
import UIKit
extension UIView {
public override var accessibilityLabel: String? {
get {
return "Hi \(super.accessibilityLabel)"
}
set {
super.accessibilityLabel = newValue
}
}
}
extension UIButton {
public override var accessibilityLabel: String? {
get {
return "Hi there \(super.accessibilityLabel)"
}
set {
super.accessibilityLabel = newValue
}
}
}
let view = UIView()
view.accessibilityLabel = "Bob"
view.accessibilityLabel
let button = UIButton()
button.accessibilityLabel = "Jill"
button.accessibilityLabel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment