Skip to content

auto-release Action in function scope #241

Open
@Osama-Fawzi

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
    }

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