Skip to content

Commit 455581c

Browse files
authored
Merge pull request #517 from segmentio/repo-sync
repo sync
2 parents 5ea098a + 73878f9 commit 455581c

File tree

1 file changed

+19
-1
lines changed
  • src/connections/sources/catalog/libraries/mobile/swift-ios

1 file changed

+19
-1
lines changed

src/connections/sources/catalog/libraries/mobile/swift-ios/index.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ To get started with the Analytics-Swift mobile library:
3434

3535
```swift
3636
var analytics: Analytics? = nil
37-
37+
3838
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
3939
// Override point for customization after application launch.
4040
let configuration = Configuration(writeKey: "WRITE_KEY")
@@ -68,6 +68,7 @@ Once you've installed the Analytics-Swift library, you can start collecting data
6868
- [Track](#track)
6969
- [Screen](#screen)
7070
- [Group](#group)
71+
- [Alias](#alias)
7172

7273
### Identify
7374
The [Identify](/docs/connections/spec/identify/) method lets you tie a user to their actions and record traits about them. This includes a unique user ID and any optional traits you know about them like their email, name, address. The traits option can include any information you want to tie to the user. When using any of the reserved traits, be sure the information reflects the name of the trait. For example, `email` should always be a string of the user's email address.
@@ -186,6 +187,23 @@ analytics.group(groupId: "user-123", traits: MyTraits(
186187
{% endcodeexampletab %}
187188
{% endcodeexample %}
188189

190+
### Alias
191+
The [Alias](/docs/connections/spec/alias/) method is used to merge two user identities, effectively connecting two sets of user data as one. When this method is called, the `newId` value overwrites the old `userId`. If no `userId` is currently set, the `newId` associates with future events as the `userId`. This is an advanced method and may not be supported across the entire destination catalog.
192+
193+
{% codeexample %}
194+
{% codeexampletab Method signature %}
195+
```swift
196+
func alias(newId: String)
197+
```
198+
{% endcodeexampletab %}
199+
200+
{% codeexampletab Example use %}
201+
```swift
202+
analytics.alias(newId: "user-123")
203+
```
204+
{% endcodeexampletab %}
205+
{% endcodeexample %}
206+
189207
## Plugin Architecture
190208
Segment's plugin architecture enables you to modify and augment how the analytics client works. From modifying event payloads to changing analytics functionality, plugins help to speed up the process of getting things done.
191209

0 commit comments

Comments
 (0)