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 DrawerKit #2

Merged
merged 85 commits into from Oct 17, 2017
Merged

Introducing DrawerKit #2

merged 85 commits into from Oct 17, 2017

Conversation

wltrup
Copy link
Contributor

@wltrup wltrup commented Oct 12, 2017

This PR introduces our implementation of "drawer views" that behave similarly to those in the Apple Maps app.

The architecture is based on a custom presentation to present and dismiss the drawer view, coupled with a pan gesture recogniser to support dragging the drawer up and down. There is also a tap recogniser to dismiss the drawer when the user taps outside of it.

There are several configuration parameters and you're urged to play with the demo app to explore them.

Speaking of the demo app, it's still incomplete in terms of supporting some of those configurations, although the library itself does support them. For instance, the library lets you set which animation timing curve to use but the demo app doesn't support that yet.

I've since simplified the demo app to its bare minimum. In order to play with different configuration parameters, you'll need to change the code, recompile, rebuild, and rerun the app.

@wltrup
Copy link
Contributor Author

wltrup commented Oct 16, 2017

@zzcgumn I've now added documentation for all exposed public entities. See e4fa1c7.

@wltrup
Copy link
Contributor Author

wltrup commented Oct 16, 2017

Here's the README as it will actually look like when live. The badges at the top still need fixing since this isn't live yet.

s.author = { "Wagner Truppel" => "wagner.truppel@babylonhealth.com" }
s.platform = :ios, "10.3"
s.source = { :git => "github.com/Babylonpartners/DrawerKit.git", :tag => "#{s.version}" }
s.source_files = "Classes/**/*.{swift}"
Copy link
Contributor

@andersio andersio Oct 16, 2017

Choose a reason for hiding this comment

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

Podspec needs an update. Please loosen the deployment target, and update the author field too. Possibly ios.development@babylonhealth.com? @RuiAAPeres

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 56bc186.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see your point about updating the author and I agree with it but, if I'm not mistaken, ios.development@babylonhealth.com is the email address for our development account with ITC. Perhaps ios-developers@babylonhealth.com instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact, I'll make that change anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in df37082.

func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
let key = (isPresentation ?
UITransitionContextViewControllerKey.to :
UITransitionContextViewControllerKey.from)

Choose a reason for hiding this comment

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

why the parenthesis?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because I find them to help readability, especially in cases like this where the contents are split between multiple lines.

public func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
guard isDrawerDraggable else { return nil }
return InteractionController(isPresentation: true,
presentingVC: presentingVC!, presentedVC: presentedVC)

Choose a reason for hiding this comment

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

Is there a way to avoid the IUO? Also presentedVC: presentedVC) could be on a new line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 12c5940 and f1338bf, respectively.

}
}

// TODO: Implement support for adaptive presentations.

Choose a reason for hiding this comment

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

Could you add this as an Issue (or whatever you prefer, TODOs in code are usually easily forgotten).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Check them here.

…on animation doesn't complete, therefore not invoking viewDidAppear, which causes the drawer not to show up at all. The work-around means that the initial presentation and dismissal aren't interactive but Product signed off on that decision. The drawers work fine under iOS 11.
@diegopetrucci
Copy link

Can you add a short description on how to use the API? I appreciate that the changes in #3 might make it obsolete so feel free to ignore this.

@wltrup
Copy link
Contributor Author

wltrup commented Oct 16, 2017

@diegopetrucci

Can you add a short description on how to use the API?

Already there, in the README.

public let configuration: DrawerConfiguration

weak var presentingVC: (UIViewController & DrawerPresenting)?
/* strong */ var presentedVC: (UIViewController & DrawerPresentable)

Choose a reason for hiding this comment

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

/* strong */ what's the purpose of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a way to say "this is a strong property and it's intentional, not an accident". There is no "strong" qualifier so I commented it.

pod 'DrawerKit', '~> 0.0.1'
```

[CocoaPods]: https://cocoapods.org/

Choose a reason for hiding this comment

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

no love for carthage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. 😄

Choose a reason for hiding this comment

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

It needs carthage support.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, but that's not what @diegopetrucci asked. I personally do not have any love for Carthage. 😉

Choose a reason for hiding this comment

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

why? Conceptually it's simpler than cocoapods and less intrusive.

Copy link
Contributor

@andersio andersio Oct 17, 2017

Choose a reason for hiding this comment

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

You just need to drop a line and say it supports Carthage, and ensures the Xcode framework target is correctly configured. This framework has no third-party dependency i.e. no need for a Cartfile.

…xcuse to turn CI off since DrawerKit fails it for lack of configuration for testing.
@andersio andersio merged commit 15b789f into develop Oct 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants