Skip to content

Commit ac1f0e0

Browse files
authored
Release 1.0.0 (#8)
## [1.0.0] - 2020-07-16 This is the first public release of the LDSwiftEventSource library. The following notes are what changed since the previous pre-release version. ### Changed - Renamed `EventHandler.onMessage` parameter `event` to `eventType`. - The `EventSource` class no longer extends `NSObject` or `URLSessionDataDelegate` to not expose `urlSession` functions.
1 parent f6c1146 commit ac1f0e0

14 files changed

+258
-73
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To reproduce**
14+
Steps to reproduce the behavior.
15+
16+
**Expected behavior**
17+
A clear and concise description of what you expected to happen.
18+
19+
**Logs**
20+
If applicable, add any log output related to your problem.
21+
22+
**Library version**
23+
The version that you are using.
24+
25+
**XCode and Swift version**
26+
For instance, XCode 11.5, Swift 5.1.
27+
28+
**Platform the issue occurs on**
29+
iPhone, iPad, macOS, tvOS, or watchOS.
30+
31+
**Additional context**
32+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I would love to see the library [...does something new...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context about the feature request here.

.github/pull_request_template.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
**Requirements**
2+
3+
- [ ] I have added test coverage for new or changed functionality
4+
- [ ] I have followed the repository's [pull request submission guidelines](../blob/master/CONTRIBUTING.md#submitting-pull-requests)
5+
- [ ] I have validated my changes against all supported platform versions
6+
7+
**Related issues**
8+
9+
Provide links to any issues in this repository or elsewhere relating to this pull request.
10+
11+
**Describe the solution you've provided**
12+
13+
Provide a clear and concise description of what you expect to happen.
14+
15+
**Describe alternatives you've considered**
16+
17+
Provide a clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
21+
Add any other context about the pull request here.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to the LaunchDarkly Swift EventSource library will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
44

5+
## [1.0.0] - 2020-07-16
6+
This is the first public release of the LDSwiftEventSource library. The following notes are what changed since the previous pre-release version.
7+
### Changed
8+
- Renamed `EventHandler.onMessage` parameter `event` to `eventType`.
9+
- The `EventSource` class no longer extends `NSObject` or `URLSessionDataDelegate` to not expose `urlSession` functions.
10+
511
## [0.5.0] - 2020-07-14
612
### Changed
713
- Default `LDSwiftEventSource` product defined for the SwiftPM package is now explicitly a dynamic product. An explicitly static product is now available as `LDSwiftEventSourceStatic`.

CONTRIBUTING.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Contributing to the LaunchDarkly Swift EventSource library
1+
Contributing to the LDSwiftEventSource library
22
================================================
33

44
Submitting bug reports and feature requests
@@ -16,14 +16,16 @@ Build instructions
1616

1717
### Prerequisites
1818

19-
This SDK is built with [XCode](https://developer.apple.com/xcode/). This version has been tested with XCode 11.4.
19+
This SDK is built with [XCode](https://developer.apple.com/xcode/). This version has been tested with XCode 11.5.
2020

21-
### Building
21+
### Building And Testing
2222

23-
The exact command used to build the SDK depends on where you want to use it (for example -- iOS, watchOS, etc.). Refer to the `xcodebuild` commands in the SDK's [continuous integration build configuration](.circleci/config.yml) for examples on how to build for the different platforms.
23+
This library can be built directly with the Swift package manager, or through XCode. To build and run tests using SwiftPM simply:
2424

25-
If you wish to clean your working directory between builds, include the `clean` goal in your `xcodebuild` command(s).
25+
```bash
26+
swift test
27+
```
2628

27-
### Testing
29+
Or in XCode, simply select the desired target and select `Product -> Test`.
2830

29-
To build the SDK and run all unit tests, include the `test` goal in your `xcodebuild` command(s).
31+
For building on the command line with `xcodebuild`, see the [continuous integration build configuration](.circleci/config.yml) for examples on building and running tests.

LDSwiftEventSource.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Pod::Spec.new do |s|
22
s.name = "LDSwiftEventSource"
3-
s.version = "0.5.0"
3+
s.version = "1.0.0"
44
s.summary = "Swift EventSource library"
55
s.homepage = "https://github.com/launchdarkly/swift-eventsource"
66
s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE.txt" }
7-
s.author = { "LaunchDarkly" => "team@launchdarkly.com" }
7+
s.author = { "LaunchDarkly" => "sdks@launchdarkly.com" }
88

99
s.ios.deployment_target = "10.0"
1010
s.watchos.deployment_target = "3.0"

LDSwiftEventSource.xcodeproj/project.pbxproj

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@
425425
DYLIB_COMPATIBILITY_VERSION = 1;
426426
DYLIB_CURRENT_VERSION = 1;
427427
DYLIB_INSTALL_NAME_BASE = "@rpath";
428-
"ENABLE_BITCODE[sdk=macosx*]" = NO;
429-
ENABLE_BITCODE = YES;
428+
ENABLE_BITCODE = YES;
429+
"ENABLE_BITCODE[sdk=macosx*]" = NO;
430430
INFOPLIST_FILE = "$(inherited)";
431431
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
432432
LD_RUNPATH_SEARCH_PATHS = (
@@ -439,6 +439,7 @@
439439
"@executable_path/../Frameworks",
440440
"@loader_path/Frameworks",
441441
);
442+
MARKETING_VERSION = 1.0.0;
442443
SKIP_INSTALL = YES;
443444
"TARGETED_DEVICE_FAMILY[sdk=appletvos*]" = 3;
444445
"TARGETED_DEVICE_FAMILY[sdk=appletvsimulator*]" = 3;
@@ -458,8 +459,8 @@
458459
DYLIB_COMPATIBILITY_VERSION = 1;
459460
DYLIB_CURRENT_VERSION = 1;
460461
DYLIB_INSTALL_NAME_BASE = "@rpath";
461-
"ENABLE_BITCODE[sdk=macosx*]" = NO;
462-
ENABLE_BITCODE = YES;
462+
ENABLE_BITCODE = YES;
463+
"ENABLE_BITCODE[sdk=macosx*]" = NO;
463464
INFOPLIST_FILE = "$(inherited)";
464465
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
465466
LD_RUNPATH_SEARCH_PATHS = (
@@ -472,6 +473,7 @@
472473
"@executable_path/../Frameworks",
473474
"@loader_path/Frameworks",
474475
);
476+
MARKETING_VERSION = 1.0.0;
475477
SKIP_INSTALL = YES;
476478
"TARGETED_DEVICE_FAMILY[sdk=appletvos*]" = 3;
477479
"TARGETED_DEVICE_FAMILY[sdk=appletvsimulator*]" = 3;
@@ -522,7 +524,7 @@
522524
);
523525
PRODUCT_BUNDLE_IDENTIFIER = com.launchdarkly.LDSwiftEventSourceTests;
524526
PRODUCT_NAME = "$(TARGET_NAME)";
525-
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
527+
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator";
526528
};
527529
name = Release;
528530
};

README.md

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,64 @@
11
# LDSwiftEventSource
2-
**Server-Sent Events for iOS, watchOS, tvOS and macOS**
32

4-
[![CircleCI](https://circleci.com/gh/launchdarkly/swift-eventsource.svg?style=svg&circle-token=0da2511947a69c1f3f88dd46e934e2d889bd1e36)](https://circleci.com/gh/launchdarkly/swift-eventsource)
3+
[![CircleCI](https://circleci.com/gh/launchdarkly/swift-eventsource.svg?style=shield)](https://circleci.com/gh/launchdarkly/swift-eventsource)
4+
[![CocoaPods](https://img.shields.io/cocoapods/v/LDSwiftEventSource.svg)](https://cocoapods.org/pods/LDSwiftEventSource)
5+
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
6+
[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-4BC51D.svg?style=flat)](https://swift.org/package-manager/)
7+
[![Platform](https://img.shields.io/cocoapods/p/LDSwiftEventSource.svg?style=flat)](https://cocoapods.org/pods/LDSwiftEventSource)
58

6-
Swift EventSource implementation originally written to replace a [LaunchDarkly fork](https://github.com/launchdarkly/ios-eventsource) of an [Objective-C implementation](https://github.com/neilco/ios-eventsource) for use in the [LaunchDarkly iOS (Swift) SDK](https://github.com/launchdarkly/ios-client-sdk).
9+
LDSwiftEventSource is a cross platform implementation of the [EventSource specification](https://www.w3.org/TR/eventsource/) written in Swift. It was developed for use in the [LaunchDarkly iOS SDK](https://github.com/launchdarkly/ios-client-sdk).
10+
11+
## Requirements
12+
- iOS 10.0+ / watchOS 3.0+ / tvOS 10.0+ / macOS 10.12+
13+
- Swift 5.0+
14+
15+
## Installation
16+
17+
### CocoaPods
18+
19+
To use the [CocoaPods](https://cocoapods.org) dependency manager to integrate LDSwiftEventSource into your Xcode project, specify it in your `Podfile`:
20+
21+
```ruby
22+
pod 'LDSwiftEventSource', '~> 1.0'
23+
```
24+
25+
### Carthage
26+
27+
To use the [Carthage](https://github.com/Carthage/Carthage) dependency manager to integrate LDSwiftEventSource into your Xcode project, specify it in your `Cartfile` :
28+
29+
```ogdl
30+
github "LaunchDarkly/swift-eventsource" ~> 1.0
31+
```
32+
33+
### Swift Package Manager
34+
35+
The [Swift Package Manager](https://swift.org/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 explicitely dynamic, and a `LDSwiftEventSourceStatic` product which is explicitely static.
36+
37+
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.
38+
39+
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.
40+
41+
```swift
42+
dependencies: [
43+
.package(url: "https://github.com/LaunchDarkly/swift-eventsource.git", .upToNextMajor(from: "1.0.0"))
44+
]
45+
```
46+
47+
## Contributing
48+
49+
We encourage pull requests and other contributions from the community. Check out our [contributing guidelines](CONTRIBUTING.md) for instructions on how to contribute to this SDK.
50+
51+
## About LaunchDarkly
52+
53+
* 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:
54+
* 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.
55+
* 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?).
56+
* 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.
57+
* 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.
58+
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
59+
* Explore LaunchDarkly
60+
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
61+
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides
62+
* [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
63+
* [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
64+
* [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies

Source/EventParser.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ class EventParser {
88
static let idLabel: Substring = "id"
99
static let eventLabel: Substring = "event"
1010
static let retryLabel: Substring = "retry"
11-
static let defaultEventName = "message"
11+
static let defaultEventType = "message"
1212
}
1313

1414
private let handler: EventHandler
1515
private let connectionHandler: ConnectionHandler
1616

1717
private var data: String = ""
1818
private var lastEventId: String?
19-
private var eventName: String = Constants.defaultEventName
19+
private var eventType: String = Constants.defaultEventType
2020

2121
init(handler: EventHandler, connectionHandler: ConnectionHandler) {
2222
self.handler = handler
@@ -53,7 +53,7 @@ class EventParser {
5353
case Constants.idLabel:
5454
lastEventId = String(value)
5555
case Constants.eventLabel:
56-
eventName = String(value)
56+
eventType = String(value)
5757
case Constants.retryLabel:
5858
if value.allSatisfy(("0"..."9").contains), let reconnectionTime = Int64(value) {
5959
connectionHandler.setReconnectionTime(Double(reconnectionTime) * 0.001)
@@ -69,9 +69,9 @@ class EventParser {
6969
if let lastEventId = lastEventId {
7070
connectionHandler.setLastEventId(lastEventId)
7171
}
72-
handler.onMessage(event: eventName, messageEvent: messageEvent)
72+
handler.onMessage(eventType: eventType, messageEvent: messageEvent)
7373
data = ""
74-
eventName = Constants.defaultEventName
74+
eventType = Constants.defaultEventType
7575
}
7676
}
7777

Source/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.0</string>
18+
<string>$(MARKETING_VERSION)</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
</dict>

0 commit comments

Comments
 (0)