Skip to content

Instantly share code, notes, and snippets.

@saru2020
Last active August 20, 2019 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save saru2020/75a246da12c41fc71d9f73cb534ef990 to your computer and use it in GitHub Desktop.
Save saru2020/75a246da12c41fc71d9f73cb534ef990 to your computer and use it in GitHub Desktop.
let heySequence = Observable.from(["H","e","y"])
let subscription = heySequence.subscribe { event in
switch event {
case .next(let value):
print("onNext Event: \(value)")
case .error(let error):
print(error)
case .completed:
print("onCompleted")
}
}
Result:
onNext Event: H
onNext Event: e
onNext Event: y
onCompleted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment