-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #71 via #75 * #82 via #83 * #84 via #86 * #85 via #87 * #89 via #90 * #91 via #92 * Removed deprecated initializer from `FeatureFlagResolver` * Updated tests * Updated Jazzy config
- Loading branch information
Showing
18 changed files
with
353 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Sources/YMFF/FeatureFlag/FeatureFlagValueTransformer.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// FeatureFlagValueTransformer.swift | ||
// YMFF | ||
// | ||
// Created by Yakov Manshin on 2/5/22. | ||
// Copyright © 2022 Yakov Manshin. See the LICENSE file for license info. | ||
// | ||
|
||
// MARK: - Transformer | ||
|
||
/// An object used by `FeatureFlag` to transform raw values into native values, and vice versa. | ||
public struct FeatureFlagValueTransformer<RawValue, Value> { | ||
|
||
let valueFromRawValue: (RawValue) -> Value? | ||
let rawValueFromValue: (Value) -> RawValue | ||
|
||
/// Creates a new instance of transformer using the specified transformation closures. | ||
/// | ||
/// - Parameters: | ||
/// - valueFromRawValue: *Required.* The closure which attempts to transform a raw value into a value. | ||
/// - rawValueFromValue: *Required.* The closure which transforms a value into a raw value. | ||
public init( | ||
valueFromRawValue: @escaping (RawValue) -> Value?, | ||
rawValueFromValue: @escaping (Value) -> RawValue | ||
) { | ||
self.valueFromRawValue = valueFromRawValue | ||
self.rawValueFromValue = rawValueFromValue | ||
} | ||
|
||
} | ||
|
||
// MARK: - Identity | ||
|
||
extension FeatureFlagValueTransformer where RawValue == Value { | ||
|
||
/// The transformer which converts between values of the same type. | ||
static var identity: FeatureFlagValueTransformer { | ||
.init(valueFromRawValue: { $0 }, rawValueFromValue: { $0 }) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
Sources/YMFF/FeatureFlagResolver/Configuration/MutableFeatureFlagResolverConfiguration.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.