The return type of functions that do not return normally, that is, a type with no values.
→ 해당 함수는 반환되지 않을 것임을 알려줌
→ exit(), fatalError() 등을 일으키는 메서드, 함수
Never
는 Error
프로토콜을 준수하고있다.
Combine
var contentPassthrough = PassthroughSubject<Content, Never>()
let cancellable = cache.contentPublisher.sink { completion in
switch completion {
**// Not required by the compiler
// since it knows there's not going to be a failure.
// case .failure:
// break**
case .finished:
print("No more content expected")
}
} receiveValue: { newContent in
print("New content published: \\(newContent.title)")
}
contentPassthrough.send(completion: .failure(Never)) 코드를 작성할수가 없다.
Never keyword in Swift: return type explained with code examples