Skip to content

Commit

Permalink
Alter fire-and-forget to take eventName and properties. Remove Expres…
Browse files Browse the repository at this point in the history
…sibleByStringLiteral conformance
  • Loading branch information
namolnad committed Oct 22, 2020
1 parent 861c35c commit 1758bff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Sources/Ahoy/Ahoy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ public final class Ahoy {
.eraseToAnyPublisher()
}

/// A fire-and-forget convenience function for `track(events:)`
public func track(_ events: Event...) {
track(events: events)
/// A fire-and-forget convenience function for tracking a single event
public func track(_ eventName: String, properties: [String: Encodable] = [:]) {
track(events: [.init(name: eventName, properties: properties)])
.retry(3)
.sink(receiveCompletion: { _ in }, receiveValue: {})
.store(in: &cancellables)
Expand Down
6 changes: 0 additions & 6 deletions Sources/Ahoy/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,3 @@ public struct Event: Encodable {
try container.encode(time, forKey: .time)
}
}

extension Event: ExpressibleByStringLiteral {
public init(stringLiteral value: String) {
self.init(name: value, properties: [:])
}
}

0 comments on commit 1758bff

Please sign in to comment.