Open RMottram opened 4 years ago
For folks looking how to use this in SwiftUI:
struct TwinkleView: UIViewRepresentable {
@State var rect: CGRect
func makeUIView(context: Context) -> UIView {
let view = UIView(frame: rect)
view.clipsToBounds = false
view.twinkle()
return view
}
func updateUIView(_ uiView: UIView, context: Context) {
}
}
//Use like this:
SomeSwiftUIView()
.overlay(
GeometryReader { geometry in //It currently doesn't work without explicitly passing the frame like this
TwinkleView(rect: CGRect(x: 0, y: 0, width: geometry.size.width, height: geometry.size.height))
}
)
Make a version for SwiftUI Framework