I am attempting to utilize the new SWAttributionView in SwiftUI since I am adding SharedWithYou support to one of my apps. Below is the UIViewRepresentable I created to wrap the UIKit component.
I have tried many combinations of view modifiers, but have not figured out how to get the height to be just what's needed. My goal is to pin the view near the bottom trailing edge of the view containing it.
If I do the same UIViewRepresentable wrapping a UILabel, for testing purposes, I can simple use .fixedSize
on it and a Spacer()
to get the vertical effect I am looking for.
struct AttributionView: UIViewRepresentable {
var highlight: SWHighlight
func makeUIView(context: Context) -> SWAttributionView {
SWAttributionView()
}
func updateUIView(_ uiView: SWAttributionView, context: Context) {
uiView.highlight = highlight
uiView.backgroundStyle = .material
uiView.horizontalAlignment = .trailing
uiView.displayContext = .summary
}
}