Search
🔨

removeDuplicates

태그
Combine 카테고리
오퍼레이터
사용용도 요약
이전에 발행된 값과 동일한 값은 발행하지 않음
세부 카테고리
작성일
2022/09/21
카테고리
Combine

사용용도

이전에 발행된 값과 동일한 값은 발행하지 않음
중복된 사용자 입력을 무시하기 위해 사용

사용방법

예제

example(of: "removeDuplicates") { // 1 let words = "hey hey there! want to listen to mister mister ?" .components(separatedBy: " ") // 2 .publisher words .removeDuplicates() .sink(receiveValue: { print($0) }) .store(in: &subscriptions) } ——— 결과 ——— hey there! want to listen to mister ?
Swift
복사