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
Add click through functionality for KolodaView #166
Conversation
ferencbeutel4711
commented
Jun 14, 2016
- We wanted to display a message below the lowest card of the stack of cards, therefore we needed to be able to force a click to go through it
- Furthermore we added the ability to add/remove the View to the NotificationCenter
- In addition to that we needed the ability to chance all of the default values to our liking, implemented the missing fields in KolodaView
//MARK: Configurations | ||
|
||
public func subscribeForNotifications(selector: Selector) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of these methods?
Hi, if I understand the Notification pattern correctly its every classes responsibility to subscribe/ unsubscribe from the notification center, especially since you dont always know when a class is deinitialized. E.g: You create a new View in a Controller and subscribe the view to a specific notification. Now you let swift handle the deinitialization since you dont want to be responsible for correctly destroying the UIView. @lukas2 Anythnig to add? |
Hm. I think you are not calling subscribeForNotifications anywhere and it can probably be deleted. Also I think UIOrientationDidChangeNotification may be outdated. Better to use viewWillTransitionToSize(:withTransitionCoordinator:) or willTransitionToTraitCollection(:withTransitionCoordinator:) because the notion of Portrait / Landscape seems to be going away. (Size classes are more reliable, because the user may be holding the device in landscape-orientation, but because he is using split screen, UI is in fact vertical.) |
@lukas2 You're right. I used notification centre in first versions of Koloda, when there was an issue with |
We do indeed use the subscription, in our controller to be exact :) I added the Notification as an extra parameter so it should be fine. |
@ferencbeutel I think you should remove it. |
private let backgroundCardsScalePercent: CGFloat = 0.95 | ||
private let backgroundCardsLeftMargin: CGFloat = 8.0 | ||
private let backgroundCardFrameAnimationDuration: NSTimeInterval = 0.2 | ||
private let defaultBackgroundCardsTopMargin: CGFloat = 4.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constants are used in frameForCardAtIndex
as default implementation. So it wasn't meant to be adjustable, because user of Koloda can apply totally different pattern for frames calculation and we'll end up with 4 extra variables.
Hi, |
Hi @ferencbeutel . I'll include configuration in next version for Swift 3, but for now could you please remove these variables and achieve desired behaviour through subclassing? |
Hey @AEugene, that are some good news! I have removed the variables and implemented the desired behavior in our code. Anything more you want me to change? |
hi @ferencbeutel . Everything is good. Thank you for contribution. I'll update pod version in a few days. |
commit 5130739 Merge: 8dd0d52 3e5c8f5 Author: AEugene <barakuda1933@gmail.com> Date: Thu Jun 30 09:08:49 2016 +0300 Merge pull request Yalantis#166 from ferencbeutel/master Add click through functionality for KolodaView commit 8dd0d52 Merge: 2b2e7b5 4867bb0 Author: AEugene <barakuda1933@gmail.com> Date: Thu Jun 30 09:06:30 2016 +0300 Merge pull request Yalantis#171 from Yalantis/feature/wrong_frame_on_suspending Fixed top card frame issue on suspending of application. commit 4867bb0 Author: Eugene Andreyev <justandjack@hotmail.com> Date: Thu Jun 30 09:05:11 2016 +0300 Fixed top card frame issue on suspending of application. commit 3e5c8f5 Author: Ferenc Beutel <ferenc.beutel@otto.de> Date: Tue Jun 28 15:45:03 2016 +0200 Remove configuration variables from KolodaView commit 714258c Author: Ferenc Beutel <ferenc.beutel@otto.de> Date: Mon Jun 27 11:10:42 2016 +0200 Remove notification center (un)subscription commit 6ba0e67 Author: 13668 <ferenc.beutel@nordakademie.de> Date: Wed Jun 15 09:42:03 2016 +0200 Add parameters to subscribeForNotifications commit 8a08ed8 Author: Ferenc Beutel <ferenc.beutel@otto.de> Date: Tue Jun 14 15:36:52 2016 +0200 Format code commit 3bf4e00 Author: Ferenc Beutel <ferenc.beutel@otto.de> Date: Tue Jun 14 15:25:57 2016 +0200 Make all default Values of KolodaView overwritable commit 8827a77 Author: Ferenc Beutel <ferenc.beutel@otto.de> Date: Tue Jun 14 14:49:20 2016 +0200 Integrate 3f9b393 commit b46df74 Author: Ferenc Beutel <ferenc.beutel@otto.de> Date: Tue Jun 14 14:33:10 2016 +0200 Make fork changes non breaking for older versions of Koloda commit e663736 Author: Ferenc Beutel <ferenc.beutel@otto.de> Date: Tue Jun 14 12:08:23 2016 +0200 Merge fork into Koloda upstream commit 5c30829 Author: Lukas Zielinski <lukas.zielinski@otto.de> Date: Thu May 26 17:12:23 2016 +0200 Added option to pass through taps when no cards are visible. commit c07f107 Author: Lukas Zielinski <lukas.zielinski@otto.de> Date: Tue Apr 26 16:26:15 2016 +0200 For background cards change top margin to 0 and scale percent to 1. commit 2b2e7b5 Merge: 8ac3d8e 3f9b393 Author: AEugene <barakuda1933@gmail.com> Date: Mon Jun 13 18:17:49 2016 +0300 Merge pull request Yalantis#162 from maximeloizeau/master Fix index out of range when removing all cards commit 3f9b393 Author: Maxime <maximeloizeau@gmail.com> Date: Thu Jun 9 21:20:44 2016 +0100 Fix index out of range when removing all cards commit 8ac3d8e Merge: 4e6f05c 03d0c32 Author: AEugene <barakuda1933@gmail.com> Date: Tue Jun 7 13:51:16 2016 +0300 Merge pull request Yalantis#160 from lbatteau/master Fixed index out of bounds error commit 4e6f05c Merge: 1b29ffa 5f7e0a9 Author: AEugene <barakuda1933@gmail.com> Date: Tue Jun 7 12:58:16 2016 +0300 Merge pull request Yalantis#157 from petalvlad/master Disallow canceling touches in subviews commit 1b29ffa Author: Ed Baev <edbaev@gmail.com> Date: Tue Jun 7 12:00:49 2016 +0300 Update README.md commit 548b98d Author: Ed Baev <edbaev@gmail.com> Date: Tue Jun 7 12:00:16 2016 +0300 Update README.md commit 03d0c32 Author: Lukas Batteau <l.batteau@indieit.nl> Date: Wed Jun 1 10:40:12 2016 +0200 Fixed index out of bounds error commit 5f7e0a9 Author: Alexander Petropavlovsky <petalvlad@gmail.com> Date: Fri May 27 09:57:06 2016 -0700 Disallow canceling touches in subviews commit 1646272 Merge: 8370da9 112b45f Author: AEugene <barakuda1933@gmail.com> Date: Wed May 25 17:16:25 2016 +0300 Merge pull request Yalantis#155 from Yalantis/feature/add_tutorial [Add] Added 'Usage' part to Readme.md commit 112b45f Author: AndrewiOS <andrew.petrov@yalantis.com> Date: Wed May 25 17:06:18 2016 +0300 [Fix] Fixed Radme.md commit 61d921f Author: AndrewiOS <andrew.petrov@yalantis.com> Date: Wed May 25 15:04:21 2016 +0300 [Add] Added "Apps using KolodaView" section commit dd6f6ec Author: AndrewiOS <andrew.petrov@yalantis.com> Date: Wed May 25 13:06:18 2016 +0300 [Add] Added 'Usage' part to Readme.md commit 8370da9 Author: Eugene Andreyev <justandjack@hotmail.com> Date: Mon May 23 18:53:21 2016 +0300 Made overlayStrength unavailable. commit 53d9c6f Merge: ca27bcd 3b4fa2f Author: AEugene <barakuda1933@gmail.com> Date: Mon May 23 17:21:16 2016 +0300 Merge pull request Yalantis#152 from Yalantis/feature/148 [Refactor] Refactored the code. deprecated overlayStrength and intro… commit 3b4fa2f Author: AndrewiOS <andrew.petrov@yalantis.com> Date: Mon May 23 17:09:31 2016 +0300 [Refactor] Refactored the code. deprecated overlayStrength and introduced updateWithProgress commit ca27bcd Author: Eugene Andreyev <justandjack@hotmail.com> Date: Tue May 10 20:59:35 2016 +0300 Added CoreGraphics dependency to SwipeResultDirection.