@@ -19,7 +19,7 @@ extension Analytics {
1919 /// - name: Name of the action, e.g., 'Purchased a T-Shirt'
2020 /// - properties: Properties specific to the named event. For example, an event with
2121 /// 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 ? ) {
2323 do {
2424 if let properties = properties {
2525 let jsonProperties = try JSON ( with: properties)
@@ -50,7 +50,7 @@ extension Analytics {
5050 /// generate the UUID and Apple's policies on IDs, see
5151 /// https://segment.io/libraries/ios#ids
5252 /// - 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 ? ) {
5454 do {
5555 if let traits = traits {
5656 let jsonTraits = try JSON ( with: traits)
@@ -70,7 +70,7 @@ extension Analytics {
7070 /// Associate a user with their unique ID and record traits about them.
7171 /// - Parameters:
7272 /// - 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 ) {
7474 do {
7575 let jsonTraits = try JSON ( with: traits)
7676 store. dispatch ( action: UserInfo . SetTraitsAction ( traits: jsonTraits) )
@@ -93,7 +93,7 @@ extension Analytics {
9393 process ( incomingEvent: event)
9494 }
9595
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 ? ) {
9797 do {
9898 if let properties = properties {
9999 let jsonProperties = try JSON ( with: properties)
@@ -112,7 +112,7 @@ extension Analytics {
112112 screen ( title: title, category: category, properties: nil as ScreenEvent ? )
113113 }
114114
115- public func group< T: Codable > ( groupId: String , traits: T ? ) {
115+ public func group< T: Encodable > ( groupId: String , traits: T ? ) {
116116 do {
117117 if let traits = traits {
118118 let jsonTraits = try JSON ( with: traits)
@@ -234,7 +234,7 @@ extension Analytics {
234234 /// - properties: Properties specific to the named event. For example, an event with
235235 /// the name 'Purchased a Shirt' might have properties like revenue or size.
236236 /// - 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 ] ? ) {
238238 do {
239239 if let properties = properties {
240240 let jsonProperties = try JSON ( with: properties)
@@ -287,7 +287,7 @@ extension Analytics {
287287 /// https://segment.io/libraries/ios#ids
288288 /// - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
289289 /// - 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 ] ? ) {
291291 do {
292292 if let traits = traits {
293293 let jsonTraits = try JSON ( with: traits)
@@ -308,7 +308,7 @@ extension Analytics {
308308 /// - Parameters:
309309 /// - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
310310 /// - 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 ] ? ) {
312312 do {
313313 let jsonTraits = try JSON ( with: traits)
314314 store. dispatch ( action: UserInfo . SetTraitsAction ( traits: jsonTraits) )
@@ -366,7 +366,7 @@ extension Analytics {
366366 /// - category: A category to the type of screen if it applies.
367367 /// - properties: Any extra metadata associated with the screen. e.g. method of access, size, etc.
368368 /// - 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 ] ? ) {
370370 do {
371371 if let properties = properties {
372372 let jsonProperties = try JSON ( with: properties)
@@ -411,7 +411,7 @@ extension Analytics {
411411 process ( incomingEvent: event, enrichments: enrichments)
412412 }
413413
414- public func group< T: Codable > ( groupId: String , traits: T ? , enrichments: [ EnrichmentClosure ] ? ) {
414+ public func group< T: Encodable > ( groupId: String , traits: T ? , enrichments: [ EnrichmentClosure ] ? ) {
415415 do {
416416 if let traits = traits {
417417 let jsonTraits = try JSON ( with: traits)
0 commit comments