Chen Li Yong Chen Li Yong - 4 months ago 24
Swift Question

What is +++ and <<< on Swift?

I just know from this github project that Swift has

+++
and
<<<
"operators". It's hard for me to search for this on google because
+++
and
<<<
maybe some kind of special characters and not showing up on search result at all. It's not even showing up on "questions that may already have your answer" section of Stack Overflow when I wrote the question title. Can you explain briefly what are these weird operators for, and maybe some articles link for further reading? Thanks.

Answer

Those operators are not a part of Swift. They are defined within that repo and meaningful only within projects which include that module. Take a look at https://github.com/xmartlabs/Eureka/blob/master/Source/Core/Operators.swift#L27

infix operator +++{ associativity left precedence 95 }

and https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AdvancedOperators.html for more on implementing custom operators in Swift.

Comments