Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Analytics-Swift
![](https://github.com/segmentio/analytics-swift/actions/workflows/swift.yml/badge.svg)
![](https://img.shields.io/github/license/segmentio/analytics-swift)

NOTE: This project is currently in the Beta phase and is covered by Segment's [First Access & Beta Preview Terms](https://segment.com/legal/first-access-beta-preview/). We encourage you
to try out this new library. Please provide feedback via Github issues/PRs, and feel free to submit pull requests.
Expand Down
14 changes: 8 additions & 6 deletions Sources/Segment/Events.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ extension Analytics {

/// Associate a user with their unique ID and record traits about them.
/// - Parameters:
/// - userId: A database ID (or email address) for this user. If you don't have a userId
/// but want to record traits, you should pass nil. For more information on how we
/// generate the UUID and Apple's policies on IDs, see https://segment.io/libraries/ios#ids
/// - userId: A database ID (or email address) for this user.
/// For more information on how we generate the UUID and Apple's policies on IDs, see
/// https://segment.io/libraries/ios#ids
/// In the case when user logs out, make sure to call ``reset()`` to clear user's identity info.
public func identify(userId: String) {
let event = IdentifyEvent(userId: userId, traits: nil)
store.dispatch(action: UserInfo.SetUserIdAction(userId: userId))
Expand Down Expand Up @@ -151,10 +152,11 @@ extension Analytics {

/// Associate a user with their unique ID and record traits about them.
/// - Parameters:
/// - userId: A database ID (or email address) for this user. If you don't have a userId
/// but want to record traits, you should pass nil. For more information on how we
/// generate the UUID and Apple's policies on IDs, see https://segment.io/libraries/ios#ids
/// - userId: A database ID (or email address) for this user.
/// For more information on how we generate the UUID and Apple's policies on IDs, see
/// https://segment.io/libraries/ios#ids
/// - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
/// In the case when user logs out, make sure to call ``reset()`` to clear user's identity info.
public func identify(userId: String, traits: [String: Any]? = nil) {
do {
if let traits = traits {
Expand Down
14 changes: 8 additions & 6 deletions Sources/Segment/ObjC/ObjCAnalytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,22 @@ extension ObjCAnalytics {

/// Associate a user with their unique ID and record traits about them.
/// - Parameters:
/// - userId: A database ID (or email address) for this user. If you don't have a userId
/// but want to record traits, you should pass nil. For more information on how we
/// generate the UUID and Apple's policies on IDs, see https://segment.io/libraries/ios#ids
/// - userId: A database ID (or email address) for this user.
/// For more information on how we generate the UUID and Apple's policies on IDs, see
/// https://segment.io/libraries/ios#ids
/// In the case when user logs out, make sure to call ``reset()`` to clear user's identity info.
@objc(identify:)
public func identify(userId: String) {
identify(userId: userId, traits: nil)
}

/// Associate a user with their unique ID and record traits about them.
/// - Parameters:
/// - userId: A database ID (or email address) for this user. If you don't have a userId
/// but want to record traits, you should pass nil. For more information on how we
/// generate the UUID and Apple's policies on IDs, see https://segment.io/libraries/ios#ids
/// - userId: A database ID (or email address) for this user.
/// For more information on how we generate the UUID and Apple's policies on IDs, see
/// https://segment.io/libraries/ios#ids
/// - traits: A dictionary of traits you know about the user. Things like: email, name, plan, etc.
/// In the case when user logs out, make sure to call ``reset()`` to clear user's identity info.
@objc(identify:traits:)
public func identify(userId: String, traits: [String: Any]?) {
analytics.identify(userId: userId, traits: traits)
Expand Down