SwiftExtension // Add bool operators.

This commit is contained in:
ShikiSuen 2023-02-18 19:13:15 +08:00
parent 6e46ba8fee
commit a83c91c738
1 changed files with 14 additions and 0 deletions

View File

@ -8,6 +8,20 @@
import Foundation
// MARK: - Bool Operators
public func |= (lhs: inout Bool, rhs: Bool) {
lhs = lhs || rhs
}
public func &= (lhs: inout Bool, rhs: Bool) {
lhs = lhs && rhs
}
public func ^= (lhs: inout Bool, rhs: Bool) {
lhs = lhs != rhs
}
// MARK: - String.localized extension
public extension StringLiteralType {