-
-
Save laevandus/ba2ea20bede60e6c66919e7f4849932e to your computer and use it in GitHub Desktop.
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
protocol FormSubmitting { | |
func submitForm(_ form: Form, validates: Bool, timeout: TimeInterval) | |
} | |
extension FormSubmitting { | |
func submitForm(_ form: Form, | |
validates: Bool = true, | |
timeout: TimeInterval = 60) { | |
self.submitForm(form, validates: validates, timeout: timeout) | |
} | |
} | |
class MyObject: FormSubmitting { | |
func submitForm(_ form: Form, validates: Bool, timeout: TimeInterval) { | |
print(#function, validates, timeout) | |
} | |
} | |
let object = MyObject() | |
object.submitForm(form) | |
// submitForm_ :validates: timeout:) true 60.0 | |
object.submitForm(form, validates: false, timeout: 30) | |
// submitForm_: validates: timeout:) false 30.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment