Publishers.TryFilter

μ œλ„€λ¦­ ꡬ쑰체 | 제곡된 μ—λŸ¬λ₯Ό λ˜μ§€λŠ” ν΄λ‘œμ €μ™€ μΌμΉ˜ν•˜λŠ” λͺ¨λ“  μš”μ†Œλ₯Ό λ‹€μ‹œ λ°œν–‰ν•˜λŠ” Publisher

μ΄λ‹ˆμ…œλΌμ΄μ €λŠ” 두 개의 인자λ₯Ό λ°›λŠ”λ‹€.

  • upstream : μƒμœ„μ— 흐λ₯΄λŠ” Publisher

  • isIncluded : μ–΄λ–€ μš”μ†Œλ₯Ό λ‹€μ‹œ λ°œν–‰ν• μ§€λ₯Ό λ‚˜νƒ€λ‚΄λŠ” μ—λŸ¬λ₯Ό λ˜μ§€λŠ” ν΄λ‘œμ €. ν΄λ‘œμ €μ˜ μ‹€ν–‰ κ²°κ³ΌλŠ” Bool νƒ€μž…μ΄λ©°, true이면 ν•΄λ‹Ή μš”μ†Œλ₯Ό λ‹€μ‹œ λ°œν–‰ν•œλ‹€.

쑰건에 λ§žλŠ” μš”μ†Œλ§Œ λ‚¨κΈ°λŠ” μž‘μ—…μ„ ν•˜κ³  μ‹ΆμœΌλ©° μž‘μ—…μ΄ μ—λŸ¬λ₯Ό 던질 수 μžˆμ„ λ•Œ μ‚¬μš©ν•  수 μžˆλ‹€.

tryFilter μ˜€νΌλ ˆμ΄ν„°μ™€ 관련이 μžˆλ‹€.

Publishers.Filter의 λ™μž‘κ³Ό κ°™μœΌλ‚˜ λ™μž‘μ„ μˆ˜ν–‰ν•˜λ‹€κ°€ μ—λŸ¬λ₯Ό λ‚Ό 수 μžˆλ‹€λŠ” 차이가 μžˆλ‹€.

RxSwift

filter μ˜€νΌλ ˆμ΄ν„°λ₯Ό μ‚¬μš©ν•˜μ—¬ κ΅¬ν˜„ν•  수 μžˆλ‹€.

ReactiveSwift

ν•΄λ‹Ή λ™μž‘μ„ κ΅¬ν˜„ν•˜κΈ° μœ„ν•œ μ˜€νΌλ ˆμ΄ν„°λ₯Ό μ œκ³΅ν•˜μ§€ μ•ŠλŠ”λ‹€.

μ°Έκ³ 

ReactiveX - Operators - Filter

Publishers.Filter

Last updated