How applidium/overlaycontainer works
Project type and purpose
• This is an iOS UI library (written in Swift) that provides an “overlay container” view controller for building draggable overlay interfaces (like Maps, Stocks, Shortcuts).
• It is packaged for CocoaPods/Carthage/SwiftPM and includes an Example app and a suite of unit tests.
High-level file structure
• Top-level packaging & CI:
• .github/… (issue templates, CI workflows)
• fastlane/… (release automation)
• Gemfile, Podspec, Package.swift, Package.resolved, Package.xcconfig
• Core library (Source/OverlayContainer + Internal/)
• Example app (Example/OverlayContainer_Example/)
• Tests (Tests/OverlayContainerTests/…)
• Assets, README, CHANGELOG, LICENSE
Core components
A. OverlayContainerViewController (entry point)
B. Child view controllers stack (“content” VCs + the topmost draggable “overlay” VC)
C. Internal view hierarchy:
1. Container view (OverlayContainerView)
2. Overlay translation views (OverlayTranslationContainerView, OverlayTranslationView)
3. Dimmer/backdrop view (OverlayContainerSheetDimmingView)
D. Gesture coordination and translation pipeline:
1. UIPanGestureRecognizer (built into the container)
2. OverlayTranslationDriver protocols & implementations
– PanGestureOverlayTranslationDriver
– ScrollViewOverlayTranslationDriver
3. OverlayTranslationFunction (strategy for rubber-band effect)
– RubberBandOverlayTranslationFunction (default)
4. OverlayTranslationTargetNotchPolicy (strategy for choosing the next notch)
– RushingForwardTargetNotchPolicy (default)
5. OverlayAnimatedTransitioning (strategy for animation)
– SpringOverlayTranslationAnimationController (default)
6. OverlayContainerTransitionCoordinator (delegate notification & animation hook)
E. Delegate interfaces (OverlayContainerViewControllerDelegate)
F. Packaging & distribution (CocoaPods/Carthage labels)
G. Example app layer (consumes the library via SPM/Pods, sets up container.viewControllers etc.)
H. Unit tests (drive TranslationControllers, Notch policies, Utility extensions)
Relationships & interactions
• The host app → imports the library → instantiates an OverlayContainerViewController
• The container VC → embeds child VCs → builds a view hierarchy of ContainerView + TranslationViews
• User pan/scroll gestures → routed to OverlayTranslationDriver → computes translation offset via OverlayTranslationFunction → asks TargetNotchPolicy for destination → invokes AnimatedTransitioning to animate → updates ContainerView’s y-position
• OverlayContainerViewControllerDelegate methods are called at each phase (willTranslate, willMove, didMove…) via OverlayContainerTransitionCoordinator
• The Example app → demonstrates setup scenarios, shows how to override delegates, attach to UINavigationController, present modally via a PresentationController subclass
• Tests → instantiate drivers/policies/functions → verify notch heights, rubber-band behavior, scroll coordination, etc.
Architectural patterns & design principles
• Protocol-oriented design (TranslationDriver, TranslationFunction, TargetNotchPolicy, AnimatedTransitioning)
• Strategy pattern for pluggable behaviors (translation math, notch policy, animations)
• Delegation for notifying client code (delegate callbacks & transition coordinator)
• Composition over inheritance (internal classes wired together at runtime)
• Clear separation: Core library vs. example app vs. tests vs. packaging/CI
Detail level
• Do not omit the OverlayContainerTransitionCoordinator—this is central for client code to hook animations
• How the delegate pattern weaves through the translation pipeline
• Packaging (CocoaPods/Carthage/SwiftPM) and CI (GitHub Actions, fastlane) externally to give context for distribution and quality assurance