Created
July 25, 2015 07:07
-
-
Save toshi0383/1e27058fa7363a7ce0f3 to your computer and use it in GitHub Desktop.
さっきのprotocol extensionをsuperclass的に扱うやつBAD ACCESSになった。 #cswift #CodePiece
This file contains hidden or 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 | |
| protocol CustomViewControllerType { | |
| func hello() | |
| } | |
| extension CustomViewControllerType { | |
| func hello() { | |
| print("hello") | |
| } | |
| } | |
| extension ViewController : CustomViewControllerType { | |
| func hello() { | |
| let a = self as CustomViewControllerType | |
| a.hello() | |
| print("yellow") | |
| } | |
| } | |
| class ViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| // Do any additional setup after loading the view, typically from a nib. | |
| hello() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment