@@ -19,7 +19,7 @@ extension Analytics {
19
19
/// - name: Name of the action, e.g., 'Purchased a T-Shirt'
20
20
/// - properties: Properties specific to the named event. For example, an event with
21
21
/// the name 'Purchased a Shirt' might have properties like revenue or size.
22
- public func track< P: Codable > ( name: String , properties: P ? ) {
22
+ public func track< P: Encodable > ( name: String , properties: P ? ) {
23
23
do {
24
24
if let properties = properties {
25
25
let jsonProperties = try JSON ( with: properties)
@@ -50,7 +50,7 @@ extension Analytics {
50
50
/// generate the UUID and Apple's policies on IDs, see
51
51
/// https://segment.io/libraries/ios#ids
52
52
/// - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
53
- public func identify< T: Codable > ( userId: String , traits: T ? ) {
53
+ public func identify< T: Encodable > ( userId: String , traits: T ? ) {
54
54
do {
55
55
if let traits = traits {
56
56
let jsonTraits = try JSON ( with: traits)
@@ -70,7 +70,7 @@ extension Analytics {
70
70
/// Associate a user with their unique ID and record traits about them.
71
71
/// - Parameters:
72
72
/// - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
73
- public func identify< T: Codable > ( traits: T ) {
73
+ public func identify< T: Encodable > ( traits: T ) {
74
74
do {
75
75
let jsonTraits = try JSON ( with: traits)
76
76
store. dispatch ( action: UserInfo . SetTraitsAction ( traits: jsonTraits) )
@@ -93,7 +93,7 @@ extension Analytics {
93
93
process ( incomingEvent: event)
94
94
}
95
95
96
- public func screen< P: Codable > ( title: String , category: String ? = nil , properties: P ? ) {
96
+ public func screen< P: Encodable > ( title: String , category: String ? = nil , properties: P ? ) {
97
97
do {
98
98
if let properties = properties {
99
99
let jsonProperties = try JSON ( with: properties)
@@ -112,7 +112,7 @@ extension Analytics {
112
112
screen ( title: title, category: category, properties: nil as ScreenEvent ? )
113
113
}
114
114
115
- public func group< T: Codable > ( groupId: String , traits: T ? ) {
115
+ public func group< T: Encodable > ( groupId: String , traits: T ? ) {
116
116
do {
117
117
if let traits = traits {
118
118
let jsonTraits = try JSON ( with: traits)
@@ -234,7 +234,7 @@ extension Analytics {
234
234
/// - properties: Properties specific to the named event. For example, an event with
235
235
/// the name 'Purchased a Shirt' might have properties like revenue or size.
236
236
/// - enrichments: Enrichments to be applied to this specific event only, or `nil` for none.
237
- public func track< P: Codable > ( name: String , properties: P ? , enrichments: [ EnrichmentClosure ] ? ) {
237
+ public func track< P: Encodable > ( name: String , properties: P ? , enrichments: [ EnrichmentClosure ] ? ) {
238
238
do {
239
239
if let properties = properties {
240
240
let jsonProperties = try JSON ( with: properties)
@@ -287,7 +287,7 @@ extension Analytics {
287
287
/// https://segment.io/libraries/ios#ids
288
288
/// - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
289
289
/// - enrichments: Enrichments to be applied to this specific event only, or `nil` for none.
290
- public func identify< T: Codable > ( userId: String , traits: T ? , enrichments: [ EnrichmentClosure ] ? ) {
290
+ public func identify< T: Encodable > ( userId: String , traits: T ? , enrichments: [ EnrichmentClosure ] ? ) {
291
291
do {
292
292
if let traits = traits {
293
293
let jsonTraits = try JSON ( with: traits)
@@ -308,7 +308,7 @@ extension Analytics {
308
308
/// - Parameters:
309
309
/// - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
310
310
/// - enrichments: Enrichments to be applied to this specific event only, or `nil` for none.
311
- public func identify< T: Codable > ( traits: T , enrichments: [ EnrichmentClosure ] ? ) {
311
+ public func identify< T: Encodable > ( traits: T , enrichments: [ EnrichmentClosure ] ? ) {
312
312
do {
313
313
let jsonTraits = try JSON ( with: traits)
314
314
store. dispatch ( action: UserInfo . SetTraitsAction ( traits: jsonTraits) )
@@ -366,7 +366,7 @@ extension Analytics {
366
366
/// - category: A category to the type of screen if it applies.
367
367
/// - properties: Any extra metadata associated with the screen. e.g. method of access, size, etc.
368
368
/// - enrichments: Enrichments to be applied to this specific event only, or `nil` for none.
369
- public func screen< P: Codable > ( title: String , category: String ? = nil , properties: P ? , enrichments: [ EnrichmentClosure ] ? ) {
369
+ public func screen< P: Encodable > ( title: String , category: String ? = nil , properties: P ? , enrichments: [ EnrichmentClosure ] ? ) {
370
370
do {
371
371
if let properties = properties {
372
372
let jsonProperties = try JSON ( with: properties)
@@ -411,7 +411,7 @@ extension Analytics {
411
411
process ( incomingEvent: event, enrichments: enrichments)
412
412
}
413
413
414
- public func group< T: Codable > ( groupId: String , traits: T ? , enrichments: [ EnrichmentClosure ] ? ) {
414
+ public func group< T: Encodable > ( groupId: String , traits: T ? , enrichments: [ EnrichmentClosure ] ? ) {
415
415
do {
416
416
if let traits = traits {
417
417
let jsonTraits = try JSON ( with: traits)
0 commit comments