Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto-release Action in function scope #241

Open
Osama-Fawzi opened this issue Oct 2, 2022 · 0 comments
Open

auto-release Action in function scope #241

Osama-Fawzi opened this issue Oct 2, 2022 · 0 comments

Comments

@Osama-Fawzi
Copy link

HI Guys,
I think I need just an enlighten or clarification, what is the reason that makes action2 deallocate and never receive any events from button 2, while action 3 is working fine...

I have double checked the memory and it's confirming the observation.

Screen Shot 2022-10-02 at 03 56 17

let action1 = Action<String, String> { input in
        print(input)
        return .just(input)
    }

    func textActions() {
        let action2 = Action<String, String> { input in
            print(input)
            return .just(input)
        }

        let action3 = CocoaAction { _ in
            print("Test")
            return .empty()
        }

        button1
            .map { _ in "Test 1" }
            .bind(to: action1.inputs)
            .disposed(by: disposableBag)

        button2
            .map { _ in "Test 2" }
            .bind(to: action2.inputs)
            .disposed(by: disposableBag)

        button3.rx.action = action3
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant