SwiftUIcon
SwiftUIcon copied to clipboard
Add canvas environment
This pull request adds a convenience canvas environment value. It can be used to avoid having to pass canvas to subviews through parameters. Instead it will now be possible to directly get it from environment. This is useful for icons that consist of mutliple subviews.
Example usage
struct Icon: View {
var body: some View {
IconStack { canvas in
// Main content that somewhere uses subview
SubView()
}
}
}
struct SubView: View {
@Environment(\.canvas) private var canvas
var body: some View {
// Use canvas
}
}