Coder Social home page Coder Social logo

applidium / overlaycontainer Goto Github PK

View Code? Open in Web Editor NEW
1.1K 15.0 93.0 18.72 MB

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

Swift 98.56% Ruby 1.44%
overlay ios uikit bottomsheet panel floating

overlaycontainer's People

Contributors

denispoifol avatar gaetanzanella avatar kocmohabta avatar peterkovacs avatar sendtobo avatar ydnar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

overlaycontainer's Issues

Wrong container Inset

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.
IMG_A0B96DA1203E-1

I already tried setting automaticallyAdjustsScrollViewInsets = false on the navigation controller.
Could someone please help me fixing this?

Example project fails to build

I'm seeing two errors in the example project when I try building it.
Repro:

  1. Download project via https
  2. Navigate to example project directory in terminal
  3. pod install
  4. Open xcworkspace
  5. Cmd+R

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')

Overlay container on all other ViewController

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

`willTranslateOverlay:` isn't being called after the user stops dragging

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.

MapsLikeViewController using SnapKit

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

Latest stable Cocoapods version 1.6.1 fails to parse swift_versions option

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!

Support for top to bottom overlay

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?

Bottom of Rigid layout panel moves above bottom of screen when dragging, is there a way to stop 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 detect when moveOverlay()'s animation done

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 release

3.0.0 will provide:

  • A new style expandableHeight
  • A fix when multiple OverlayContainer track the same scroll
  • A better state invalidation management
  • A new translation animation controller without spring behavior
  • New delegate API fully tested

Rigid issue

"let overlayContainer = OverlayContainerViewController(style: .rigid)" - This feature is not working for me.

Current Notch Position

If we can check current position or get notified when position changes, that would be great.

Thanks

`reloadNotchHeights()` should be exposed

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.

Trigger Translation to certain Notch from code?

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:

  1. Trigger the translations to each Notch position from code?
  2. present the OverlayContainerView from code?
  3. Use an own UIViewControllerTransitioningDelegate?

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).

Multiple Overlay with different notches?

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.

description_notches

Thank you.

Page sheet dismiss gesture conflict with driving scroll view

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.

Not working properly when added source folder directly without installling pods

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.

Duration of animation for moveOverlay

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..

Missing param in willEndDraggingOverlay delegate call

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)

Subclass OverlayContainerViewController?

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.

Fix Unit tests

Since the Carthage support, unit tests fail because of the Quick & Nimble dependancies. It should be fixed.

Search Field not enable

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 to define the starting notch position?

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!

First tap in UITableView after dragging up or down is ignored

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.

didEndDraggingOverlay is called after a moveOverlay call

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?

addChild not recognized

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!

Dismissable by swipe

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 DrivingScrollView has bounces=false, the overlay does not respond

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?

Unable to subclass OverlayContainerViewController. Everything is public, not open

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.

Wrong spring animation on overlays containing subviews pinned to bottom

The default overlay animator SpringOverlayTranslationAnimationController doesn't animate correctly overlays with subviews pinned to bottom.

bug

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).

spring

scrollViewDrivingOverlay for multiple child views

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?

Corner radius?

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?

Stopping at top

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.

Untitled.mov.zip

Drawer not responding to scroll in contained scrollView when in navigationController?

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.

Is there a way to animate the OverlayContainer alongside another animation?

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.

OverlayViewController is not layout before animation when set before moveOverlay(toNotchAt:animated:)

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)

Carthage build not compatible with XCode 10.2 / Swift 5

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! 💜

navigation preferLargeTitles breaks layout constraints

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!

Animation jumps when touching overlay during animation (BackdropExampleViewController)

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.