Skip to content

Commit 3a257bd

Browse files
author
Mikhail Markin
committed
Relays+Infallible
1 parent e0ab8c4 commit 3a257bd

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

RxRelay/Relays+Infallible.swift

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// Relays+Infallible.swift
3+
// RxSwift
4+
//
5+
// Created by Mikhail Markin on 18/06/2022.
6+
// Copyright © 2022 Krunoslav Zaher. All rights reserved.
7+
//
8+
9+
public extension BehaviorRelay {
10+
/// Convert to an `Infallible`
11+
///
12+
/// - returns: `Infallible<Element>`
13+
func asInfallible() -> Infallible<Element> {
14+
Infallible(self.asObservable())
15+
}
16+
}
17+
18+
public extension PublishRelay {
19+
/// Convert to an `Infallible`
20+
///
21+
/// - returns: `Infallible<Element>`
22+
func asInfallible() -> Infallible<Element> {
23+
Infallible(self.asObservable())
24+
}
25+
}
26+
27+
public extension ReplayRelay {
28+
/// Convert to an `Infallible`
29+
///
30+
/// - returns: `Infallible<Element>`
31+
func asInfallible() -> Infallible<Element> {
32+
Infallible(self.asObservable())
33+
}
34+
}

0 commit comments

Comments
 (0)