diff --git a/Sources/ComposableEnvironment/ComposableEnvironment.swift b/Sources/ComposableEnvironment/ComposableEnvironment.swift index 943810e..4f3a078 100644 --- a/Sources/ComposableEnvironment/ComposableEnvironment.swift +++ b/Sources/ComposableEnvironment/ComposableEnvironment.swift @@ -2,16 +2,12 @@ import Foundation open class ComposableEnvironment { public required init() {} - @usableFromInline var dependencies: ComposableDependencies = .init() - @usableFromInline var hasReceivedDependenciesFromParent: Bool = false - @usableFromInline var knownChildren: Set = [] - @inlinable @discardableResult public func with(_ keyPath: WritableKeyPath, _ value: V) -> Self { dependencies[keyPath: keyPath] = value diff --git a/Sources/ComposableEnvironment/Dependencies.swift b/Sources/ComposableEnvironment/Dependencies.swift index 05f5788..dc25f9c 100644 --- a/Sources/ComposableEnvironment/Dependencies.swift +++ b/Sources/ComposableEnvironment/Dependencies.swift @@ -5,16 +5,13 @@ public protocol DependencyKey { } public struct ComposableDependencies { - @usableFromInline var values = [AnyHashableType: Any]() - @inlinable public subscript(_ key: T.Type) -> T.Value where T: DependencyKey { get { values[AnyHashableType(key)] as? T.Value ?? key.defaultValue } set { values[AnyHashableType(key)] = newValue } } - @inlinable mutating func mergeFromUpstream(_ upstreamDependencies: ComposableDependencies) { // We should preserve existing overrides values = values.merging(upstreamDependencies.values, diff --git a/Sources/ComposableEnvironment/Dependency.swift b/Sources/ComposableEnvironment/Dependency.swift index ce1edf7..ce068dc 100644 --- a/Sources/ComposableEnvironment/Dependency.swift +++ b/Sources/ComposableEnvironment/Dependency.swift @@ -1,7 +1,6 @@ /// Use this property wrapper to declare depencies in a ComposableEnvironment subclass. @propertyWrapper public struct Dependency { - @inlinable public static subscript( _enclosingInstance instance: EnclosingSelf, wrapped wrappedKeyPath: ReferenceWritableKeyPath, @@ -18,7 +17,6 @@ public struct Dependency { } } - @usableFromInline var keyPath: KeyPath public init(_ keyPath: KeyPath) { diff --git a/Sources/ComposableEnvironment/DerivedEnvironment.swift b/Sources/ComposableEnvironment/DerivedEnvironment.swift index 2d74829..667a38c 100644 --- a/Sources/ComposableEnvironment/DerivedEnvironment.swift +++ b/Sources/ComposableEnvironment/DerivedEnvironment.swift @@ -1,6 +1,5 @@ @propertyWrapper public final class DerivedEnvironment where Value: ComposableEnvironment { - @inlinable public static subscript( _enclosingInstance instance: EnclosingSelf, wrapped wrappedKeyPath: ReferenceWritableKeyPath, @@ -21,7 +20,6 @@ public final class DerivedEnvironment where Value: ComposableEnvironment } } - @usableFromInline var environment: Value public init(wrappedValue: Value) { diff --git a/Sources/ComposableEnvironment/Internal/AnyType.swift b/Sources/ComposableEnvironment/Internal/AnyType.swift index 703f993..c3c5df3 100644 --- a/Sources/ComposableEnvironment/Internal/AnyType.swift +++ b/Sources/ComposableEnvironment/Internal/AnyType.swift @@ -1,22 +1,18 @@ -@usableFromInline struct AnyHashableType: Hashable { private var type: Any private var isEqualTo: (AnyHashableType) -> Bool private var hashInto: (inout Hasher) -> Void - @usableFromInline init(_ type: T.Type) { self.type = type isEqualTo = { $0.type is T.Type } hashInto = { $0.combine(String(describing: T.self)) } } - @usableFromInline func hash(into hasher: inout Hasher) { hashInto(&hasher) } - @usableFromInline static func == (lhs: AnyHashableType, rhs: AnyHashableType) -> Bool { lhs.isEqualTo(rhs) }