Reason behind the existence of contentLayer
#15
Comments
Objective-C usually favors composition over subclassing. With the current approach, you can add shimmering to any existing view or layer, without having to make a subclass of it. Using composition can be especially useful when you don't control the creation of the view hierarchy. For example, you could add a shimmering effect to an You can still use it with any view or layer you create yourself as long as you put the contents inside a single view or layer. Then, internally set that as the |
Sorry if I’ll look dumb, but I really don’t get it.
You’re still going to create a view (whose
That’s exactly what I tried to do, but my special environment has spit on me. (Just for clarity, I’m porting Shimmer to Titanium SDK, where views lay in a very special way, and adding middle-views without breaking the layout is not that trivial.) |
I see what you mean now, the shimmering layer could shimmer all of its children, rather than just the |
Actually I just made that changes, it’s just a fact of removing everything Would you mind if I make a PR for you to explore the idea? |
(Oh, by the way, your code is really self explanatory. Awesome component perfectly executed) |
Ok, I’m surely missing something, but the fact that
FBShimmeringLayer
can’t simply be used with+layerClass
and give whatever view the shimmering effect really bugs me.Why is there the need for a
contentLayer
to limit the effect? Shouldn’t be simplyself.mask = _maskLayer
instead?I tried this approach and worked perfectly…
(please keep in mind I just moved to Obj-C)
The text was updated successfully, but these errors were encountered: