Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add initial support for hooks #370

Merged
merged 3 commits into from
Apr 30, 2024
Merged

Conversation

keelerm84
Copy link
Member

No description provided.

@keelerm84 keelerm84 requested a review from a team April 19, 2024 18:35
@keelerm84 keelerm84 force-pushed the mk/sc-239714/add-hooks branch 2 times, most recently from 3ac5430 to 947b129 Compare April 19, 2024 19:13
public typealias EvaluationSeriesData = [String: Any]

/// Protocol for extending SDK functionality via hooks.
public protocol Hook {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this forward compatible? I'm not super familiar with swift protocols.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. When we add a new method on this protocol, we will need to also provide an extension to that protocol with a default implementation.

LaunchDarkly/LaunchDarklyTests/LDClientHookSpec.swift Outdated Show resolved Hide resolved
LaunchDarkly/LaunchDarkly/LDClientVariation.swift Outdated Show resolved Hide resolved
/// Implementation specific hook data for evaluation stages.
///
/// Hook implementations can use this to store data needed between stages.
public typealias EvaluationSeriesData = [String: Any]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be immutable if possible (I read 'possible' as not requiring excessive effort and not being inconvenient for consumption). Is there a simple way to achieve immutability here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dictionaries in Swift are passed by value (but lazily copied). So providing a dictionary to a function is already an immutable operation.

@keelerm84 keelerm84 merged commit e7cebc1 into feat/hooks Apr 30, 2024
4 checks passed
@keelerm84 keelerm84 deleted the mk/sc-239714/add-hooks branch April 30, 2024 17:16
keelerm84 added a commit that referenced this pull request May 2, 2024
@github-actions github-actions bot mentioned this pull request May 2, 2024
keelerm84 pushed a commit that referenced this pull request May 2, 2024
🤖 I have created a release *beep* *boop*
---


##
[9.7.0](9.6.2...9.7.0)
(2024-05-02)


### Features

* Add initial support for hooks
([#370](#370))
([93239fc](93239fc))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: LaunchDarklyReleaseBot <LaunchDarklyReleaseBot@launchdarkly.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants