Skip to content

Commit

Permalink
Add ConfidenceContextProvider protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziodemaria committed Apr 9, 2024
1 parent 29890f7 commit 3c0b02c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sources/Confidence/Confidence.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

public class Confidence: ConfidenceEventSender {
private let parent: ConfidenceEventSender?
private let parent: ConfidenceContextProvider?
private var localContext: ConfidenceStruct

public var context: ConfidenceStruct {
Expand Down
6 changes: 6 additions & 0 deletions Sources/Confidence/ConfidenceContextProvider.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Foundation

/// A Contextual implementer returns the current context
public protocol ConfidenceContextProvider {
var context: ConfidenceStruct { get set }
}
4 changes: 1 addition & 3 deletions Sources/Confidence/Contextual.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import Foundation

/// A Contextual implementer maintains context data and can create child instances
/// that can still access their parent's data
public protocol Contextual {
var context: ConfidenceStruct { get set }

public protocol Contextual: ConfidenceContextProvider {
func updateContextEntry(key: String, value: ConfidenceValue)
func removeContextEntry(key: String)
func clearContext()
Expand Down

0 comments on commit 3c0b02c

Please sign in to comment.