Created
January 12, 2016 10:58
-
-
Save NicholasTD07/144552defd6429d1d981 to your computer and use it in GitHub Desktop.
Things go wrong in Swift 2.1
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
/// # Things go wrong in Swift 2.1 | |
/// ## A protocol overriding/giving default implementation to its parent's methods | |
/// If you have a class conform to this protocol and try compile, you will get segmentation fault 11. | |
protocol SingleSectionTableViewDataSource: UITableViewDataSource { | |
typealias ItemType | |
var items: [ItemType] { get set } | |
} | |
extension SingleSectionTableViewDataSource { | |
func numberOfSectionsInTableView(tableView: UITableView) -> Int { | |
return 1 | |
} | |
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return items.count | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment