Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Sources/Component/Hosting/ComponentHostingRoot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ internal struct ComponentHostingRoot<Content: View>: View {
internal let content: Content
internal var context: ComponentContext

@Environment(\.self)
private var environment: EnvironmentValues

internal var body: some View {
let environment = context.resolveEnvironment(environment)

let theme = environment
let theme = context
.componentViewController?
.view
.tokens
Expand All @@ -21,7 +16,9 @@ internal struct ComponentHostingRoot<Content: View>: View {
content
.iflet(theme) { $0.tokenThemeKey($1.key) }
.iflet(theme) { $0.tokenThemeScheme($1.scheme) }
.environment(\.self, environment)
.transformEnvironment(\.self) { environment in
environment = context.resolveEnvironment(environment)
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import Foundation

public protocol DecorableByImageSymbolConfiguration {

func symbolConfiguration(_ symbolConfiguration: ImageSymbolConfiguration?) -> Self
func imageSymbolConfiguration(_ symbolConfiguration: ImageSymbolConfiguration?) -> Self
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ internal struct ImageSymbolConfigurationDecorator<Value: DecorableByImageSymbolC
internal let symbolConfiguration: ImageSymbolConfiguration?

internal func decorate(_ value: Value, theme: TokenTheme) -> Value {
value.symbolConfiguration(symbolConfiguration)
value.imageSymbolConfiguration(symbolConfiguration)
}
}

extension Token where Value: DecorableByImageSymbolConfiguration {

public func symbolConfiguration(_ symbolConfiguration: ImageSymbolConfiguration?) -> Self {
public func imageSymbolConfiguration(_ symbolConfiguration: ImageSymbolConfiguration?) -> Self {
decorated(by: ImageSymbolConfigurationDecorator(symbolConfiguration: symbolConfiguration))
}
}
2 changes: 1 addition & 1 deletion Sources/Token/Value/Image/ImageValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ extension ImageValue:
changing { $0.insets = insets }
}

public func symbolConfiguration(_ symbolConfiguration: ImageSymbolConfiguration?) -> Self {
public func imageSymbolConfiguration(_ symbolConfiguration: ImageSymbolConfiguration?) -> Self {
changing { $0.symbolConfiguration = symbolConfiguration }
}
}
Expand Down
Loading