You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Amazing product, thank you for your contribution to the world of tvOS 👍
One thing that took me a little bit to figure out, might be good to put it in your docs or something, but this is an example of how you would make this work in Interface Builder:
// Stub container
classSimpleParallaxContainer:UIView,ParallaxContainer{func focusChanged(_ focus:ParallaxFocusState){}func parallaxShadow(forFocus:ParallaxFocusState, defaultShadow:Shadow)->Shadow?{return defaultShadow
}}
// Because ParallaxView doesn't implement initWith(coder:) you can't place it in Interface Builder.
// This UIView subclass substitutes itself with a ParallaxView at runtime.
classParallaxPlaceholder:UIView{overridefunc layoutSubviews(){
super.layoutSubviews()guardlet sup =self.superview else{return} // make sure we have a superview
// Create a container
letcont=SimpleParallaxContainer.init(frame:self.bounds)
// Move all of the placeholder's subviews into the container
self.subviews.forEach{(view)inletf= view.frame
view.removeFromSuperview()
cont.addSubview(view)
view.frame = f
}
// Create a parallax view, using the container we just built
letpView=ParallaxView<SimpleParallaxContainer>(layerContainer: cont)
// Remove ourselves from the view hierarchy and replace with the parallax view
sup.insertSubview(pView, aboveSubview:self)
pView.frame =self.frame
self.removeFromSuperview()}}
Definitely no problem if I'm going about this wrong and you feel like pointing it out. Either way, thanks again!
The text was updated successfully, but these errors were encountered:
Amazing product, thank you for your contribution to the world of tvOS 👍
One thing that took me a little bit to figure out, might be good to put it in your docs or something, but this is an example of how you would make this work in Interface Builder:
Definitely no problem if I'm going about this wrong and you feel like pointing it out. Either way, thanks again!
The text was updated successfully, but these errors were encountered: