Created
June 30, 2022 18:50
-
-
Save kiarashvosough1999/35fc95e4cec2c0682288fb05af37b85c to your computer and use it in GitHub Desktop.
UIActionPublished
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
#if canImport(Combine) | |
import Combine | |
@available(iOS 13.0, *) | |
final class ActionPublished: UIAction { | |
convenience init(actionSubject: InFailablePassThroughSubject<Void>?) { | |
self.init { [weak actionSubject] _ in | |
actionSubject?.send(()) | |
} | |
} | |
convenience init<T>(actionSubject: InFailablePassThroughSubject<T>?, signalValue: T) { | |
self.init { [weak actionSubject, signalValue] _ in | |
actionSubject?.send(signalValue) | |
} | |
} | |
required init?(coder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment