Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tomvanzummeren/TZStackView #10

Closed
pjebs opened this issue Jun 21, 2015 · 12 comments
Closed

tomvanzummeren/TZStackView #10

pjebs opened this issue Jun 21, 2015 · 12 comments

Comments

@pjebs
Copy link

pjebs commented Jun 21, 2015

I was wondering what the difference was between this control:

https://github.com/tomvanzummeren/TZStackView

@nsomar
Copy link
Owner

nsomar commented Jun 21, 2015

Hey,

I think the main difference is that its written in swift, which means you will have to include libswiftcore.dylib and other swift libs when compiling your app.

Another main difference is in the way both project deals with changing settings, while in OAStackView performance was key (since you are going to use the stackview in complicated layouts). Changing axes and other settings will not cause the stack view to remove all the constraints.

In TZStackView changes will invalidate the constraints and add them again, this might affect performance badly for bigger, more complicated UIs.

Other differences are in the testing approaches both project uses, I have to say that testing constraint is the best approach, I will be moving the project test suite to constraints in the upcoming days.

@tomvanzummeren
Copy link

Thanks for the feedback ☺️

And sorry, I wasn't aware of this component when I created mine. I was participating WWDC when I heard about this new UIStackView and I was so enthusiastic about it that I decided to create it myself for earlier iOS versions.

But OAStackView has beaten me to the punch! I really did search for something similar when I started, but couldn't find anything!

Btw, another difference: I implemented all distribution options of the UIStackView, OAStackView did just do Fill and FillEqually. Also, just like with UIStackView, you can put subview.hidden = true inside an animation block and it will animate hiding/showing the subview. I implemented that as well with TZStackView

@harlanhaskins
Copy link
Contributor

It seems like TZStackView has more features implemented, but OAStackView is faster and has more recognition.

Maybe @tomvanzummeren should contribute back to OAStackView?

@nsomar
Copy link
Owner

nsomar commented Jun 21, 2015

@tomvanzummeren and @harlanhaskins The other distribution options have been introduced today by PR #8. the readme will be updated to reflect this addition soon.

I am not sure I understand the hiding argument, but OAStackView does indeed handle hiding the views, I didn't try, but setting a subview hidden inside a beginAnimation block should animate it as I only manipulate the layout constraints.

@tomvanzummeren and @harlanhaskins I am open to discus any contribution option guys :)

@tomvanzummeren
Copy link

Try it. Animating the hidden property of a subview doesn't just work out of the box. That's why it's mentioned in a separate part of the UIStackView docs.

But anyway, we both took different approaches. No use to contribute. OAStackView did it with performance in mind and is written in ObjC. Mine is in Swift and I decided performance is not important as you're not adding and removing subviews multiple times per second. I also can't imagine that UIStackView is doing it any differently. With TZStackView I focussed on having the exact same API and behaviour to be able to drop-in replace it with the real UIStackView and see no difference.

@tomvanzummeren
Copy link

And also:

I created TZStackView just because I wanted it for myself. This time I decided to share it with everyone by putting it on GitHub. I can take it down if it is not appreciated, but I won't contribute. It already took way too much of my spare time to create this one.

@nsomar
Copy link
Owner

nsomar commented Jun 21, 2015

@tomvanzummeren This is what happens when you hide a view inside an animation block
369f8e6eed

The change was to explicitly call layoutIfNeeded in the animation block.
I know that hidden is not animated, but OAStackView has KVO observation on the subviews, that will remove the view and rearrange the constraints accordingly.

@tomvanzummeren
Copy link

Well that's no good, is it? The red block disappears immediately. With the real UIStackView, it collapses before it disappears.

On Sun, Jun 21, 2015 at 6:56 PM, Omar Abdelhafith
[email protected] wrote:

@tomvanzummeren This is what happens when you hide a view inside an animation block
369f8e6eed

The change was to explicitly call layoutIfNeeded in the animation block.

Reply to this email directly or view it on GitHub:
#10 (comment)

@tomvanzummeren
Copy link

This is what I mean:

TZStackView hidden animation

I also implemented it with KVO.

@nsomar
Copy link
Owner

nsomar commented Jun 21, 2015

@tomvanzummeren oh, now I see, thanks, I will create an issue for that

@tomvanzummeren
Copy link

Oh wow, so I am contributing after all. Happy to help!

@nsomar
Copy link
Owner

nsomar commented Jun 21, 2015

@tomvanzummeren thanks for the help :) I will close this issue and open the another one.

@nsomar nsomar closed this as completed Jun 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants