applidium / overlaycontainer Goto Github PK
View Code? Open in Web Editor NEWNon-intrusive iOS UI library to implement overlay based interfaces
Home Page: https://gaetanzanella.github.io/2018-12-17/replicating-apple-maps-overlay
License: Other
Non-intrusive iOS UI library to implement overlay based interfaces
Home Page: https://gaetanzanella.github.io/2018-12-17/replicating-apple-maps-overlay
License: Other
I saw that in version 1.3 you added the extension snippet to the read me setup. In version 1.1.1 this was previously accessible and used by us. Any particular reason why this extension is not exposed anymore? https://github.com/applidium/ADOverlayContainer/blob/c8d65bcb0216af1a117b4cce6af5218b84e9c263/Source/Classes/Internal/Extensions/UIViewController%2BChildren.swift
Hi Sir,
is it possible to push another viewcontroller in sliding view on tapping of table view cell in that slide view.please help
I added a UINavigationController to the BackdropExampleViewController:
overlayController.viewControllers = [UINavigationController(rootViewController: searchViewController)]
Now there is space on top of the navigation bar when I let the swipe to the maximum state. When I drag it there it is fixed.
I already tried setting automaticallyAdjustsScrollViewInsets = false
on the navigation controller.
Could someone please help me fixing this?
I'm seeing two errors in the example project when I try building it.
Repro:
pod install
Expected: Project builds and runs.
Actual: Two errors prevent building
:-1: /Users/aaron/Downloads/ADOverlayContainer-master/Example/Pods/Pods/Target Support Files/Pods-OverlayContainer_Example/Pods-OverlayContainer_Example.debug.xcconfig: unable to open file (in target "OverlayContainer_Example" in project "OverlayContainer") (in target 'OverlayContainer_Example')
:-1: /Users/aaron/Downloads/ADOverlayContainer-master/Example/Pods/Pods/Target Support Files/Pods-OverlayContainer_Tests/Pods-OverlayContainer_Tests.debug.xcconfig: unable to open file (in target "OverlayContainer_Tests" in project "OverlayContainer") (in target 'OverlayContainer_Tests')
I want to overlays the OverlayContainer even the top view controller was changed ( ex: push
or pop a new view controller from origin view controller which has created OverlayContainer)
btw, I can implement the function just manually pass the OverlayContainer view controller to destination view controller and if destination view controller has the OverlayContainer and just add to self view, it is easy, but sometimes hard to implement the function with nested view controller and delegate not assigned itself,
I just searched few things and I could got a keyword Window, but didn't thinking know how to implement,
is anyone implement the flow ??, give me ideas, thank you
I'm trying to fade away views when the user drags the overlay or when the overlay is travelling between notches, but willTranslateOverlay:
doesn't appear to be called on the delegate when the user has let go of the overlay and the overlay starts travelling automatically to the nearest notch.
Hello,
First off thank you so much for this awesome library. It looks great! 😃
I've been trying to replicate the MapsLikeViewController.swift
page using SnapKit instead of storyboards. I got close however touches of map don't go through since the overlay container captures them, despite using the Passthrough view.
I've created a small sample repo here. Any help would be appreciated.
Thanks,
-Sami
After table view scrolled user can't select table item, user must to make double click on item, do you know how I can fix it?
https://youtu.be/TXUkxCBuoG8
It would be nice to have progress delegate
If a Podfile specifies ADOverlayContainer dependency by commit like so:
pod 'OverlayContainer', :git => 'https://github.com/applidium/ADOverlayContainer.git', :commit => '570dc63ca719db8f98bf46ea726d228a3204ed3d'
Then command pod install
fails:
[!] Failed to load 'OverlayContainer' podspec:
[!] Invalid `OverlayContainer.podspec` file: undefined method `swift_versions=' for #<Pod::Specification name="OverlayContainer">
Did you mean? swift_version=
swift_version.
# from /var/folders/8g/86qwfhy13c9cgkyw0pw04k5c0000gn/T/d20190502-74201-1hkatng/OverlayContainer.podspec:15
# -------------------------------------------
# s.swift_version = '4.2'
> s.swift_versions = ['4.2']
#
# -------------------------------------------
And this issue on CocoaPods github page tells that swift_versions
option will only be available when 1.7.0 is released: CocoaPods/CocoaPods#8191
That is a problem for people who would like to make a fork and specify an exact commit
Is this option even necessary now?
P.S: Thanks for this beautiful framework!
Would it be possible to support drag down overlay view with this library. I managed to achieve the desired effect by flipping the transform however as expected the pan gesture would need to be adjusted too
Do you have plans to support this?
Hello, really liking the library so far as it feels more responsive than other libraries and feels like apple’s own floating panel.
I just have a quick question about the ridged style. Is there a way to stop the bottom of the overlay container from moving higher than the bottom of the screen as the user drags. I’ve tried using the flexible style for my layout but the overlay controller squishes my stack view.
Pretty much just wanting to know if there’s a way to pin the bottom of the rigid overlay controller to the bottom of the screen.
I want to make OverlayContainerViewController
's dismiss animation
the animation would be like this : when NavigationVC stack's size became to 0, OverlayContainerViewController
is going to call moveOverlay()
with zero index of notch's height and I want to remove the OverlayViewController
when the moveOverlay
's animation is done
But translationController?.moveOverlay
hasn't completionHandler should I add a completionHadnler manually? or there is another way to detect when moveOverlay()
's animation is done ?
3.0.0 will provide:
expandableHeight
OverlayContainer
track the same scroll"let overlayContainer = OverlayContainerViewController(style: .rigid)" - This feature is not working for me.
I want to adjust the height of the notches when I push a viewcontroller which has a different height with first pushed viewcontroller..
is It possible?
If we can check current position or get notified when position changes, that would be great.
Thanks
I have a situation where my notch heights are changing, so I found the function OverlayContainerViewControllerConfiguration.reloadNotchHeights()
which does the job.
Unfortunately the configuration
property inside OverlayContainerViewController
is private so I can't call it.
As a quick workaround you could declare configuration
as private(set)
which allows reading the variable.
Hi, thanks for creating this library.
I have a usecase where I would like to display the Overlay at a later point and not immediately in a StackedViewController as in the examples. Few options that might help me in this are:
present
the OverlayContainerView from code?Do any of them make sense if so are there some examples (might have overlooked something and I'm rather new to iOS and Swift).
Hi,
is it possible to add multiple overlays which are nested? So I've got a background layer, a first overlay layer, and a second overlay with the special condition that the second overlay has not the full height of the first overlay layer and its max height is limited to 2/3 of the height of the first overlay.
I've created an image to illustrate it.
Thank you.
When scrolling down any scroll view in the overlay in view controllers presented using page sheet modal presentation style, the view controller is interactively dismissed.
Page sheet should not be dismissed when scrolling the driving scroll view down. But it could be enabled for other other areas outside the overlay controller.
Hello sir,
child.didMove(toParentViewController: self) and child.didMove(toParent: self) are these both the same?. i am getting error and in child.didMove(toParent: self) so i renamed it to child.didMove(toParentViewController: self) .but i am getting other issue when i added this in my app.
i am not able to drag back ground map view but scroll view is scrolling.
when i installed using pods,drag is working fine.
but when i directly add source folder,its not working.please help.
This is more of a request for help than an issue, I guess, but I can't figure out how to set the duration of the animation when calling moveOverlay(toNotchAt:,animated:)
. I even considered importing the entire OverlayContainer as classes instead of a pod so I could manipulate it if it was private, but I can't find a duration anywhere, just velocity and advanced animation protocols.
It would be nice to make it animate alongside another animation too, but I just don't understand how.
The ShowOverlayExample just uses the basic "moveOverlay" with the default duration, so it couldn't help me..
In an older version, you used to pass the transitionCoordinator. I use this to match animations when the overlay is animating to a notch. Your comments still reference the transitionCoordinator but it is missing in the call function see below.
/// Tells the delegate when the user finishs dragging the overlay view controller with the specified velocity.
///
/// - parameter containerViewController: The container requesting this information.
/// - parameter overlayViewController: The current top overlay view controller.
/// - parameter transitionCoordinator: The transition coordinator object associated with the translation end.
func overlayContainerViewController(_ containerViewController: OverlayContainerViewController,
willEndDraggingOverlay overlayViewController: UIViewController,
atVelocity velocity: CGPoint)
Currently it is not possible to subclass OverlayContainerViewController, afaik.
Xcode error message: "Cannot inherit from non-open class 'OverlayContainerViewController' outside of its defining module"
This is probably due to OverlayContainerViewController being "public" and not "open". Open exists since Swift 3 and allows a class or function to be subclassed or overridden outside the current module.
It would be great if we could subclass OverlayContainerViewController for custom contained overlays.
Since the Carthage support, unit tests fail because of the Quick & Nimble dependancies. It should be fixed.
The search field is not enable!
Unable to enter any text inside searchBar.
One more In cocoacontrols its says objective-C but the project build in swift.
Is there a way for me to specify that i want the OverlayContainerViewController to begin at notch position x e.g. if i have 3 notches, min, med, max - can i specify that i want it to start at the med notch and not the min?
Awesome library by the way!
I have found an issue where if your overlay view controller contains a table view and drives the swipe up/down, after the up/down animation is complete (after overlayContainerViewController(containerViewController: _, willTranslateOverlay: _, transitionCoordinator: _)
) the first tap on the table view doesn't register. You need to tap again. You can also see that the scroll indicator stays visible and doesn't disappear as it should. You can see this behaviour in your example project with BackdropExampleViewController
.
This is not a bug and intentional I'd guess, but what do you think about separating 'dragging' and calling moveOverlay callbacks, e.g something similar to
func overlayContainerViewController(_ containerViewController: OverlayContainerViewController,
didEndDraggingOverlay overlayViewController: UIViewController,
transitionCoordinator: OverlayContainerTransitionCoordinator) {}
The above would be the original callback but only called when a user actually drags.
func overlayContainerViewController(_ containerViewController: OverlayContainerViewController,
didEndMovingOverlay overlayViewController: UIViewController,
transitionCoordinator: OverlayContainerTransitionCoordinator) {}
The above would be an additional callback but only called after moveOverlay call has finished?
Thoughts?
Hi,
I just upgraded from 1.1.2 to 1.3.0 and the extension
func addChild(_ child: UIViewController, in containerView: UIView)
was not recognized by my app, suggesting me to use UIKit's addChild(). I checked the code differences and the only difference I could find was the that in 1.1.2 the methods are marked as public. Even tough XCode says public is redundant.
I cleaned the app and still had to revert to 1.1.2
I like your library! nice work!
Is it possible to dismiss the overlay by swiping down with a certain velocity?
I was thinking that it might be possible to hook into the process before/while the notch policy would kick-in or even do this with a notch policy, but somehow that seems kludgy and I am not sure this is the way to go. Any pointers are welcome.
When using a normal overlay without a drivingScrollView, and you try to drag it too far up, it has this nice dampening effect on the entire overlay (it lets you drag it a few pixels, then bounces back). I wanted to replicate this with a tableView as content, but when dragging it too far top, the overlay stays the same (max notch) and the tableView scrolls out of bounds and bounces back. I thought maybe it would work if I disabled bounces
, but that just makes the entire overlay unscrollable, probably because didScroll isn't called.
Is there any other way of replicating the dampening, but with scrollViews?
This is more a question than an issue, sorry if it's not the right place, but I am experimenting with the container and found the need to retain some additional information/data within the container. I would like to subclass the OverlayContainerViewController (e.g class MyCustomContainerViewController:OverlayContainerViewController
) and add my data there, as well as it would give me the opportunity to directly override other functions if needed (if the functions are changed to open
as well).
Is there a reason this project is public
rather than open
?
I could just include the source files into my project to fix it (same module), but with your recent addition of Swift Package, I'd like to do it the right way.
Please add Carthage support.
Scrollview not driving overlay after you scrolled down and scrolled to top.
The default overlay animator SpringOverlayTranslationAnimationController
doesn't animate correctly overlays with subviews pinned to bottom.
The bug seems to be related to UISpringTimingParameters
which animates all the components of the frame of each views if the initialVelocity parameter is not null. Even if the views are pinned to the bottom (see how the red view goes beyond its bottom limit when animated).
I have controller with multiple controllers. And I have scrollView in every child controller.
I need to call
func overlayContainerViewController(_ containerViewController: OverlayContainerViewController,
scrollViewDrivingOverlay overlayViewController: UIViewController) -> UIScrollView?
func every time I change visible child view.
How can I solve it?
I'm having a hard time figuring out where to make the overlay controller have a corner radius. Can you point me in the right direction?
In the MapsLikeViewController-Example with an iPhone 6S and changing the notch heights to
private func notchHeight(for notch: OverlayNotch, availableSpace: CGFloat) -> CGFloat {
switch notch {
case .maximum:
return availableSpace * 9 / 10
case .minimum:
return availableSpace * 1 / 4
}
}
the scrolling of the tableview is not followed through, it stops at the top notch and the tableview does not begin to scroll. First rounding the notch values (or cast to Int and back to CGFloat) solves the problem.
[!] Unable to find a pod with name, author, summary, or description matching OverlayContainer
I've stumbled on an issue where the drawer won't accept scrolling at all. I first discovered this because I'm trying to make this work with a CollectionView instead of a TableView, but I manage to reproduce it with tableView as well.
Reproduce:
Open the OverlayContainer_Example-project
• AppDelegate:18, change to window?.rootViewController = ModalNavigationViewController()
• SearchViewController:44, insert self.tableView.bounces = false
Observe the following:
This seems to be due to bounces=false
, since it doesn't happen without it. But this is happening to me by default with UICollectionView, even though bounces = true
.
Also, if you now change the SearchController:58 return 10
instead of 100, then it's actually impossible to minimize it by dragging the content, because you can't scroll up or down, due to no bouncing:
Not shown in the gif; it's still possible to move it by dragging on the searchbar-area.
So, the tableView.bounces=false makes this particular problem - but my issue is that this happens by default when I use a collectionView, and I'm not sure how to fix it.
I did use the delegate to set the overlayController.drivingScrollView
as in the example, which makes it scrollable. And everything is working perfectly as long as the height of the content is taller than the max notch, so scrolling can occur everywhere. But when the content size is somewhere between minimum and maximum notch, then it acts weird when dragging to max height, and won't be dragged up/down after that.
Edit; I see now that the scrollViewDidScroll
doesn't fire when the content is maximized.. not sure how to investigate further.
I've seen the examples/comments for how to animate another object alongside the animation of the OverlayContainer, e.g fade in backdrop based on the height of the drawer. But is there a way to animate the height of the drawer based on another animation?
In my case, I have a UINavigationController in the container, and when I navigate from one view to another (inside the container), the origin- and the destination-viewControllers may have different "preferred" notches, so I want to animate the height of the drawer to perfectly match the transition from "origin-notch" to "destination-notch" along the navigation animation. This include when the user swipes back, which is done using a transitionCoordinator and a context (e.g no set duration).
The only way I've found to go from one notch to another is to call moveOverlay(toNotchAt:Int, animated:Bool
, which won't work in this case.
When setting the viewControllers property just before animating appearance of the overlay :
overlayContainerViewController.viewControllers = [
mainViewController,
backdropViewController,
overlayViewController,
].compactMap { $0 }
overlayContainerViewController.moveOverlay(to: .medium, animated: true)
We end up with the overlayViewcontroller being animated in its height like it should, but also in its width because its view did not layout properly before the begining of the animation.
I could make this work by forcing the layout of the superview of the overlayViewController, but it is a hacky solution, and it would definitely be better if the pod handled this force layout on its own :
overlayContainerViewController.viewControllers = [
mainViewController,
backdropViewController,
overlayViewController,
].compactMap { $0 }
overlayViewController?.view.superview?.setNeedsLayout()
overlayViewController?.view.superview?.layoutIfNeeded()
overlayContainerViewController.moveOverlay(to: .medium, animated: true)
i mean width of scroll view if reduced,map view can be seen partially while scrolling.
in default case, scroll view is completely blocking map view.
With XCode 10.2 and Swift 5, building ADOverlayContainer
fails because the Nimble dependency is not compatible with the new Swift toolchain.
Currently ADOverlayContainer
is referencing:
github "Quick/Nimble" ~> 7.3
github "Quick/Quick" ~> 1.3
But these Nimble versions still use the Swift 3 toolchain which is no longer supported in the XCode 10.2 build tools.
This can be solved by updating the Nimble dependencies to the latest versions:
github "Quick/Nimble" ~> 8.0
github "Quick/Quick" ~> 2.0
It would be great, if you could update that. (I know, I could have made a pull request for that but I found that overkill — and also I don't know about your test setup and if you can simple upgrade Nimble or if there are breaking changes in version 8)
Thanks for your great work on this framework! 💜
Hello there,
For starters, this project is great and I have been enjoying using it. I am running into an issue because I'm using a navigation controller with large titles. This creates a constraint error:
[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x600002d929e0 OverlayContainer_Example.DetailHeaderView:0x7f8bbb509520.height == 70 (active)>",
"<NSLayoutConstraint:0x600002d92c10 OverlayContainer_Example.DetailHeaderView:0x7f8bbb509520.top == UILayoutGuide:0x6000037a0700'UIViewSafeAreaLayoutGuide'.top (active)>",
"<NSLayoutConstraint:0x600002d92df0 UITableView:0x7f8bbb827600.bottom == UIView:0x7f8bbb4112f0.bottom (active)>",
"<NSLayoutConstraint:0x600002d92ee0 V:[OverlayContainer_Example.DetailHeaderView:0x7f8bbb509520]-(0)-[UITableView:0x7f8bbb827600] (active)>",
"<NSLayoutConstraint:0x600002d92c60 V:|-(0)-[UIView:0x7f8bbb4112f0] (active, names: '|':OverlayContainer.OverlayContainerView:0x7f8bbb401fb0 )>",
"<NSLayoutConstraint:0x600002d91ae0 UIView:0x7f8bbb4112f0.bottom == OverlayContainer.OverlayContainerView:0x7f8bbb401fb0.bottom (active)>",
"<NSLayoutConstraint:0x600002d99400 V:|-(0)-[OverlayContainer.OverlayContainerView:0x7f8bbb401fb0] (active, names: '|':OverlayContainer.OverlayTranslationView:0x7f8bbb407c10 )>",
"<NSLayoutConstraint:0x600002d992c0 OverlayContainer.OverlayTranslationView:0x7f8bbb407c10.height == 203 (active)>",
"<NSLayoutConstraint:0x600002d99310 OverlayContainer.OverlayContainerView:0x7f8bbb401fb0.bottom == OverlayContainer.OverlayTranslationView:0x7f8bbb407c10.bottom (active)>",
"<NSLayoutConstraint:0x600002d92ad0 'UIViewSafeAreaLayoutGuide-top' V:|-(140)-[UILayoutGuide:0x6000037a0700'UIViewSafeAreaLayoutGuide'] (active, names: '|':UIView:0x7f8bbb4112f0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600002d929e0 OverlayContainer_Example.DetailHeaderView:0x7f8bbb509520.height == 70 (active)>
This can be replicated on the example repo by setting the target to ios11, and then adding this code to AppDelegate
to setup a basic navigation controller.
let navigationController = UINavigationController(rootViewController: ShortcutsLikeViewController())
navigationController.navigationBar.prefersLargeTitles = true
window?.rootViewController = navigationController
Not sure if theres something else I can do to get around this, or whether its just a bug in OverlayContainer.
Thanks in advance for the help!
Hi,
I'm trying to animate other views in sync with the overlay transition. The BackdropExampleViewController example comes very close to what I want to do.
Everything works fine, but when I slide up the overlay, and then quickly slide it down again (before the slide-up animation has completed), the background transparency "jumps" a bit.
I've attached a video. It looks subtle here, but it becomes more annoying in my actual application. Do you have an idea how to fix this?
Best,
Johannes
animation.mov.zip
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.