Skip to content

Instantly share code, notes, and snippets.

@kiarashvosough1999
Created June 30, 2022 18:50
Show Gist options
  • Save kiarashvosough1999/35fc95e4cec2c0682288fb05af37b85c to your computer and use it in GitHub Desktop.
Save kiarashvosough1999/35fc95e4cec2c0682288fb05af37b85c to your computer and use it in GitHub Desktop.
UIActionPublished
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