ashfurrow / Swift-RAC-Macros

(Temporary) Replacements for the RAC and RACObserve macros in Swift
MIT License
54 stars 6 forks source link

Weird compilation behavior for ~> function/Operator #3

Open edwardIshaq opened 9 years ago

edwardIshaq commented 9 years ago

Hello, I'm not sure if this is the best place to post this question. I Keep getting an error when using the ~> operator but not when using the <~ one. Basically they're bot calling the same function, right ? so there shouldn't be too much difference than the order of the arguments.

Any idea how to fix this ? I currently only use <~ for obvious reasons but there must be a way to get it to work!

P.S. the source for the <~ and ~> is in a framework which is included by this target. The only case where both work is if I include this code within the current target instead of via a shared framework, which defeats the purpose of a framework ... :/

    RAC(viewModel, "searchString") <~ searchField.rac_textSignal() //Works
    searchField.rac_textSignal() ~> RAC(viewModel, "searchString") //Breaks on compilation

error: ambiguous operator declarations found for operator searchField.rac_textSignal() ~> RAC(viewModel, "searchString") ^

:0: note: found this matching operator declaration :0: note: found this matching operator declaration .../MyViewController.swift:117:38: error: operator is not a known binary operator searchField.rac_textSignal() ~> RAC(viewModel, "searchString")
ashfurrow commented 9 years ago

Huh, weird. You're installing via CocoaPods? Or some other way? Can you create a sample project and upload it for me?

I tried on Eidolon to reverse the direction of the operator and it worked fine. We use CocoaPods and the have the following import statement:

import ReactiveCocoa
import Swift_RAC_Macros
edwardIshaq commented 9 years ago

I'll prepare a sample project and upload it to gitHub I'm using Carthage to make reactivecocoa framework and I bedding it in my own framework which I'm using on a different target.

Sent from my iPhone

On Apr 7, 2015, at 8:15 AM, Ash Furrow notifications@github.com wrote:

Huh, weird. You're installing via CocoaPods? Or some other way? Can you create a sample project and upload it for me?

I tried on Eidolon to reverse the direction of the operator and it worked fine. We use CocoaPods and the have the following import statement:

import ReactiveCocoa import Swift_RAC_Macros — Reply to this email directly or view it on GitHub.

JARinteractive commented 7 years ago

Swift already defines the ~> operator for internal use. It is DefaultPrecedence. I ran into this trying to define the same operator in RxSugar.