Created
June 25, 2015 18:15
-
-
Save keith/ed925987ad63638e89ca to your computer and use it in GitHub Desktop.
Overriding Extensions bug fixed in Swift 2.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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