Skip to content

auto-release Action in function scope #241

Description

@Osama-Fawzi

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
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions