Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
codykerns authored Feb 17, 2024
1 parent 56af9b8 commit bf8a971
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ StableID.identify(id: <new_user_identifier>)
To receive updates when a user ID changes (for example from detecting a change from another iCloud device), configure a delegate:

```swift
// call after configuring StableID
StableID.set(delegate: MyClass())

class MyClass: StableIDDelegate {
Expand All @@ -67,6 +68,27 @@ class MyClass: StableIDDelegate {
}
```

### Custom ID Generators

By default, StableID uses a standard `IDGenerator` that generates simple UUIDs.

If you want any generated identifiers to follow a certain pattern, you can implement a custom ID generator by conforming to `IDGenerator` and implementing `generateID()`:

```swift
struct MyCustomIDGenerator: IDGenerator {
func generateID() -> String {
// do something custom
return myGeneratedID
}
}
```

Then pass the generator as part of the `configure` method:

```swift
StableID.configure(idGenerator: MyCustomIDGenerator())
```

## License

MIT

0 comments on commit bf8a971

Please sign in to comment.