Swiftpack.co - launchdarkly/swift-eventsource as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
launchdarkly/swift-eventsource 1.2.1
Server-sent events (SSE) client implementation in Swift for iOS, macOS, tvOS, and watchOS
⭐️ 21
🕓 36 weeks ago
iOS macOS watchOS tvOS linux
.package(url: "https://github.com/launchdarkly/swift-eventsource.git", from: "1.2.1")


CircleCI CocoaPods Carthage compatible SwiftPM compatible Platform

LDSwiftEventSource is a cross platform implementation of the EventSource specification written in Swift. It was developed for use in the LaunchDarkly iOS SDK. Generated API docs are available on GitHub Pages.


  • iOS 10.0+ / watchOS 3.0+ / tvOS 10.0+ / macOS 10.12+
  • Swift 5.1+



To use the CocoaPods dependency manager to integrate LDSwiftEventSource into your Xcode project, specify it in your Podfile:

pod 'LDSwiftEventSource', '~> 1.2'


To use the Carthage dependency manager to integrate LDSwiftEventSource into your Xcode project, specify it in your Cartfile:

github "LaunchDarkly/swift-eventsource" ~> 1.2

Swift Package Manager

The Swift Package Manager is a dependency manager integrated into the swift compiler and Xcode. Note that the LDSwiftEventSource Swift package provides both a LDSwiftEventSource product, which is explicitly dynamic, and a LDSwiftEventSourceStatic product which is explicitly static.

To integrate LDSwiftEventSource into an Xcode project, go to the project editor, and select Swift Packages. From here hit the + button and follow the prompts using https://github.com/LaunchDarkly/swift-eventsource.git as the URL.

To include LDSwiftEventSource in a Swift package, simply add it to the dependencies section of your Package.swift file. And add the desired product as a dependency for your targets.

dependencies: [
    .package(url: "https://github.com/LaunchDarkly/swift-eventsource.git", .upToNextMajor(from: "1.2.0"))


We encourage pull requests and other contributions from the community. Check out our contributing guidelines for instructions on how to contribute to this SDK.

About LaunchDarkly

  • LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
    • Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
    • Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
    • Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
    • Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
  • LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out our documentation for a complete list.
  • Explore LaunchDarkly


Stars: 21
Last commit: 6 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

[1.2.1] - 2021-02-10
36 weeks ago


  • SwiftLint configuration. Linting will be automatically run as part of the build if Mint is installed.
  • Support for building docs with jazzy. These docs are available through GitHub Pages.


  • Reconnection backoff was always reset if the previous successful connection was at least backoffResetThreshold prior to the scheduling of a reconnection attempt. The connection backoff has been corrected to not reset after the first reconnection attempt until the next successful connection. Thanks to @tomasf for the PR (#14).
  • On an UnsuccessfulResponseError the configured connectionErrorHandler would be called twice, the second time with a URLError.cancelled error. Only if the second call returned ConnectionErrorAction.shutdown would the EventSource client actually shutdown. This has been corrected to only call the connectionErrorHandler once, and will shutdown the client if ConnectionErrorAction.shutdown is returned. Thanks to @tomasf for the PR (#13).
  • A race condition that could cause the EventSource client to restart after shutting down has been fixed.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics