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

Introducing "IB" #no-public-changes #529

Merged
merged 6 commits into from
Jan 30, 2018
Merged

Introducing "IB" #no-public-changes #529

merged 6 commits into from
Jan 30, 2018

Conversation

tbaranes
Copy link
Member

@tbaranes tbaranes commented Jan 17, 2018

I take a look at #528 to make IBAnimatable working without interface builder, AND without subviews.

This PR implements a working solution for this issue, currently supporting:

  • FillDesignable
  • CornerDesignable

Usage:

view.ib.cornerRadius = 12
view.ib.opacity = 0.1
view.ib.fillColor = .green
view.ib.predefinedColor = ColorType.flatAlizarin

In order to get this, I had to change each protocols to add a configure(in view: UIView) since ib is not a view itself. It will ask a bit of work to refactor all of them, but it will work in the end. There's one issue left: how to "reload" the properties when rotating, bounds did change... all the work currently in layoutSubviews

Other branches related to this feature ready to go (after a rebase):

  • feature/ib_borderdesignable

Also, I don't know how we should document (documentation + demo project) this, any suggestions?

@JakeLin
Copy link
Member

JakeLin commented Jan 17, 2018

@tbaranes 💪 thanks for picking up this feature quickly, it is a fun and challenging one. It is a great start 👍

I had to change each protocols to add a configure(in view: UIView) since ib is not a view itself.

I think we need to do more than just UIView, some of them are not UIViews. I haven't seen any better way to achieve the goal without doing that yet

how to "reload" the properties when rotating,

Is it possible to provide a reload method like view.ib.reload to ask the user to call? It will call configureAfterLayoutSubviews() and autoRunAnimation()

I don't know how we should document (documentation + demo project) this, any suggestions?

I prefer adding code comments as documentation now. We may add documentation comment in class IB, we can refer to how the other libraies doing , for example, RxSwift. And using a playground is good for demonstrating the API in done.

@tbaranes
Copy link
Member Author

tbaranes commented Jan 18, 2018

I think we need to do more than just UIView, some of them are not UIViews. I haven't seen any better way to achieve the goal without doing that yet

Which component do you have in mind? Anyway, I think we can start by supporting only UIView then add the others later by keeping a list in #528

I prefer adding code comments as documentation now. We may add documentation comment in class IB, we can refer to how the other libraies doing , for example, RxSwift. And using a playground is good for demonstrating the API in done.

Sounds good to me, I don't really have a preference. Should we create a dedicated PR for this once the feature itself is more advanced?

@tbaranes
Copy link
Member Author

reload() method added, I think it's ready to go beside documentation (depending if we make the documentation in this PR or in a new one)

@tbaranes
Copy link
Member Author

Travis failing due to the tests, will pass once #530 has been merged and rebased

@IBAnimatableBot
Copy link

IBAnimatableBot commented Jan 21, 2018

2 Warnings
⚠️ Consider adding supporting documentation to this change. Documentation can be found in the docs directory.
⚠️ Consider adding / updating the demo ap.

Generated by 🚫 Danger

@tbaranes
Copy link
Member Author

tbaranes commented Jan 22, 2018

@JakeLin Ready for final review considering that docs will be added in another PR!

Copy link
Member

@JakeLin JakeLin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 It's good to go

@JakeLin
Copy link
Member

JakeLin commented Jan 30, 2018

@tbaranes

Which component do you have in mind? Anyway, I think we can start by supporting only UIView then add the others later by keeping a list in #528

I was thinking some components like AnimatableBarButtonItem. They are not UIViews

@tbaranes tbaranes changed the title Introducing "IB" Introducing "IB" #no-public-changes Jan 30, 2018
@tbaranes tbaranes merged commit a46d326 into master Jan 30, 2018
@tbaranes tbaranes deleted the feature/ib branch January 30, 2018 13:36
@JakeLin
Copy link
Member

JakeLin commented Jan 31, 2018

@tbaranes great work 👍

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

Successfully merging this pull request may close these issues.

None yet

3 participants