SwiftPM unary operator

56 Views Asked by At

I have simple method in extension:


postfix operator |

extension Bool {
    
    static postfix func |<T: Numeric> (p: Self) -> T {
        p ? 1 : 0
    }

}

But in Tests target is not possible to use this unary operator:

let intTrue: Double = true|
let intFalse: Int = false|

Error

'|' is not a prefix unary operator

I'm trying to convert library to SwiftPM:

https://github.com/El-Machine/Pipe

0

There are 0 best solutions below