Created Failable<Bool, T>.toggle() method

This commit is contained in:
Caleb Kleveter 2018-11-30 07:50:08 -06:00
parent f25f2abf10
commit ec8febb489
No known key found for this signature in database
GPG Key ID: B38DBD5CF2C98D69
1 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1,7 @@
extension Failable where T == Bool {
/// See [`Bool.toggle()`](https://developer.apple.com/documentation/swift/bool/2994863-toggle).
public mutating func toggle()throws {
try self <~ !self.value
}
}