Skip to content

Instantly share code, notes, and snippets.

@bimusiek
Created February 26, 2015 16:56
Show Gist options
  • Save bimusiek/43dad861801aa0c62288 to your computer and use it in GitHub Desktop.
Save bimusiek/43dad861801aa0c62288 to your computer and use it in GitHub Desktop.
Swift allows override public method with private one
//Original file
class GiftCardPaymentViewController{
public func nextStep() {
[...]
}
}
// Some testcase
class GiftCardPaymentTest:XCTestCase {
func testIt() {
class MockedGiftCardPaymentViewController:GiftCardPaymentViewController {
var nextStepExecutedCount = 0
// SO FUCKING APPLE ALLOWES YOU TO SAY HERE PRIVATE... Even suggest it. If you do public you get:
// https://www.dropbox.com/s/7lbj0868dvctmia/Screenshot%202015-02-26%2017.55.47.png?dl=0
private override func nextStep() {
nextStepExecutedCount++;
super.nextStep()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment