├── LBBottomSheet.doccarchive.zip ├── LBBottomSheet-Demo ├── LBBottomSheet-Demo │ ├── Resources │ │ ├── Assets │ │ │ └── Assets.xcassets │ │ │ │ ├── Contents.json │ │ │ │ ├── Colors │ │ │ │ ├── Contents.json │ │ │ │ ├── buttonBackground.colorset │ │ │ │ │ └── Contents.json │ │ │ │ ├── shadow.colorset │ │ │ │ │ └── Contents.json │ │ │ │ ├── blurContainerBackground.colorset │ │ │ │ │ └── Contents.json │ │ │ │ └── tableViewBackground.colorset │ │ │ │ │ └── Contents.json │ │ │ │ ├── Images │ │ │ │ ├── Contents.json │ │ │ │ ├── swift.imageset │ │ │ │ │ ├── swift.png │ │ │ │ │ └── Contents.json │ │ │ │ ├── mountains.imageset │ │ │ │ │ ├── mountains.png │ │ │ │ │ └── Contents.json │ │ │ │ ├── background.imageset │ │ │ │ │ ├── background.png │ │ │ │ │ └── Contents.json │ │ │ │ └── PackageIcon.imageset │ │ │ │ │ ├── PackageIcon.png │ │ │ │ │ └── Contents.json │ │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── ItunesArtwork@2x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ └── Contents.json │ │ │ │ └── AccentColor.colorset │ │ │ │ └── Contents.json │ │ └── Plist │ │ │ └── Info.plist │ ├── LBBottomSheet-Demo.entitlements │ ├── Application │ │ ├── AppDelegate.swift │ │ ├── Appearance │ │ │ ├── Appearance.swift │ │ │ └── UIColor+Appearance.swift │ │ ├── Model │ │ │ ├── DemoTestCase.swift │ │ │ └── MenuEntry.swift │ │ ├── UI │ │ │ ├── XibName.swift │ │ │ ├── Common │ │ │ │ └── Cells │ │ │ │ │ ├── SwiftSection │ │ │ │ │ ├── SwiftSectionCell.swift │ │ │ │ │ └── SwiftSectionCell.xib │ │ │ │ │ ├── InvertedCard │ │ │ │ │ ├── InvertedCardCell.swift │ │ │ │ │ └── InvertedCardCell.xib │ │ │ │ │ ├── Card │ │ │ │ │ ├── CardCell.swift │ │ │ │ │ └── CardCell.xib │ │ │ │ │ ├── Image │ │ │ │ │ └── ImageCell.xib │ │ │ │ │ ├── Standard │ │ │ │ │ └── StandardCell.xib │ │ │ │ │ ├── Text │ │ │ │ │ └── TextCell.xib │ │ │ │ │ └── ImageCardCell │ │ │ │ │ └── ImageCardCell.xib │ │ │ └── Demo │ │ │ │ └── DemoViewController.swift │ │ ├── Coordinator │ │ │ ├── WindowedCoordinator.swift │ │ │ ├── Coordinator.swift │ │ │ ├── Root │ │ │ │ └── RootCoordinator.swift │ │ │ └── Main │ │ │ │ └── MainCoordinator.swift │ │ └── Base.lproj │ │ │ └── LaunchScreen.storyboard │ ├── Utils │ │ └── Components │ │ │ ├── Extensions │ │ │ ├── UITableViewCell+Extension.swift │ │ │ ├── CACornerMask+Extension.swift │ │ │ ├── URL+Extension.swift │ │ │ └── UIView+Extension.swift │ │ │ └── CVForm │ │ │ ├── CVRowsBuilder.swift │ │ │ ├── CVRow.swift │ │ │ ├── CVTableViewController.swift │ │ │ └── CVTableViewCell.swift │ └── Modules │ │ └── DemoTestCaseFactory.swift └── LBBottomSheet-Demo.xcodeproj │ ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── swiftpm │ │ └── Package.resolved │ └── xcshareddata │ ├── IDETemplateMacros.plist │ └── xcschemes │ └── LBBottomSheet-Demo.xcscheme ├── Sources └── LBBottomSheet │ ├── LBBottomSheet.docc │ ├── Resources │ │ ├── PackageIcon.png │ │ ├── Examples │ │ │ └── Intro.png │ │ ├── Grabber │ │ │ ├── Grabber.png │ │ │ ├── Grabber~dark.png │ │ │ └── Background │ │ │ │ ├── GrabberBackground.png │ │ │ │ └── GrabberBackground~dark.png │ │ ├── Shadow │ │ │ ├── Shadow.png │ │ │ └── Shadow~dark.png │ │ └── TopInset │ │ │ ├── TopInset.png │ │ │ └── TopInset~dark.png │ └── Documentation.md │ ├── Utils │ ├── Extensions │ │ ├── UIScrollView+Extension.swift │ │ ├── UIGestureRecognizer+Extensions.swift │ │ ├── UIScreen+Extension.swift │ │ ├── UIApplication+Extension.swift │ │ ├── CACornerMask+Extension.swift │ │ ├── Mirror+Extension.swift │ │ ├── UIColor+Extension.swift │ │ ├── UIView+Extension.swift │ │ └── UIViewController+Extension.swift │ └── Components │ │ └── ForwardingEventsView.swift │ ├── Protocols │ ├── BottomSheetInteractionDelegate.swift │ └── BottomSheetPositionDelegate.swift │ ├── BottomSheetConstant.swift │ ├── Model │ └── BottomSheetController+Theme.swift │ └── UI │ └── BottomSheet.storyboard ├── .swiftpm └── xcode │ └── package.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDETemplateMacros.plist ├── Package.swift ├── .gitignore └── LICENSE /LBBottomSheet.doccarchive.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet.doccarchive.zip -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Colors/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/LBBottomSheet.docc/Resources/PackageIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/Sources/LBBottomSheet/LBBottomSheet.docc/Resources/PackageIcon.png -------------------------------------------------------------------------------- /Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Examples/Intro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Examples/Intro.png -------------------------------------------------------------------------------- /Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Grabber/Grabber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Grabber/Grabber.png -------------------------------------------------------------------------------- /Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Shadow/Shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Shadow/Shadow.png -------------------------------------------------------------------------------- /Sources/LBBottomSheet/LBBottomSheet.docc/Resources/TopInset/TopInset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/Sources/LBBottomSheet/LBBottomSheet.docc/Resources/TopInset/TopInset.png -------------------------------------------------------------------------------- /Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Grabber/Grabber~dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Grabber/Grabber~dark.png -------------------------------------------------------------------------------- /Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Shadow/Shadow~dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Shadow/Shadow~dark.png -------------------------------------------------------------------------------- /Sources/LBBottomSheet/LBBottomSheet.docc/Resources/TopInset/TopInset~dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/Sources/LBBottomSheet/LBBottomSheet.docc/Resources/TopInset/TopInset~dark.png -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Grabber/Background/GrabberBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Grabber/Background/GrabberBackground.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Grabber/Background/GrabberBackground~dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/Sources/LBBottomSheet/LBBottomSheet.docc/Resources/Grabber/Background/GrabberBackground~dark.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/swift.imageset/swift.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/swift.imageset/swift.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/LBBottomSheet-Demo.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/mountains.imageset/mountains.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/mountains.imageset/mountains.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/background.imageset/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/background.imageset/background.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/PackageIcon.imageset/PackageIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunabeeStudio/LBBottomSheet/HEAD/LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/PackageIcon.imageset/PackageIcon.png -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Plist/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ITSAppUsesNonExemptEncryption 6 | 7 | UIViewControllerBasedStatusBarAppearance 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "pins" : [ 3 | { 4 | "identity" : "lbbottomsheet", 5 | "kind" : "remoteSourceControl", 6 | "location" : "https://github.com/LunabeeStudio/LBBottomSheet", 7 | "state" : { 8 | "branch" : "develop", 9 | "revision" : "4d61112d28a45b1f2420a94710c85bde7fb1321f" 10 | } 11 | } 12 | ], 13 | "version" : 2 14 | } 15 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/swift.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "swift.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/mountains.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "mountains.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/PackageIcon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "PackageIcon.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Images/background.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "background.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.5 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "LBBottomSheet", 8 | platforms: [.iOS(.v11)], 9 | products: [ 10 | .library( 11 | name: "LBBottomSheet", 12 | targets: ["LBBottomSheet"]), 13 | ], 14 | targets: [ 15 | .target( 16 | name: "LBBottomSheet", 17 | dependencies: []) 18 | ], 19 | swiftLanguageVersions: [.v5] 20 | ) 21 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // LBBottomSheet-Demo 4 | // 5 | // Created by Nicolas on 22/10/2021. 6 | // 7 | 8 | import UIKit 9 | 10 | @UIApplicationMain 11 | final class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | private let rootCoordinator: RootCoordinator = RootCoordinator() 14 | 15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 16 | rootCoordinator.start() 17 | return true 18 | } 19 | 20 | func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { .portrait } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Colors/buttonBackground.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "extended-gray", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "white" : "0.777" 9 | } 10 | }, 11 | "idiom" : "universal" 12 | }, 13 | { 14 | "appearances" : [ 15 | { 16 | "appearance" : "luminosity", 17 | "value" : "dark" 18 | } 19 | ], 20 | "color" : { 21 | "color-space" : "extended-gray", 22 | "components" : { 23 | "alpha" : "1.000", 24 | "white" : "0.333" 25 | } 26 | }, 27 | "idiom" : "universal" 28 | } 29 | ], 30 | "info" : { 31 | "author" : "xcode", 32 | "version" : 1 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Colors/shadow.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "extended-gray", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "white" : "0.333" 9 | } 10 | }, 11 | "idiom" : "universal" 12 | }, 13 | { 14 | "appearances" : [ 15 | { 16 | "appearance" : "luminosity", 17 | "value" : "dark" 18 | } 19 | ], 20 | "color" : { 21 | "color-space" : "srgb", 22 | "components" : { 23 | "alpha" : "1.000", 24 | "blue" : "0x00", 25 | "green" : "0x00", 26 | "red" : "0x00" 27 | } 28 | }, 29 | "idiom" : "universal" 30 | } 31 | ], 32 | "info" : { 33 | "author" : "xcode", 34 | "version" : 1 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Colors/blurContainerBackground.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "0.250", 8 | "blue" : "0xFF", 9 | "green" : "0xFF", 10 | "red" : "0xFF" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | }, 15 | { 16 | "appearances" : [ 17 | { 18 | "appearance" : "luminosity", 19 | "value" : "dark" 20 | } 21 | ], 22 | "color" : { 23 | "color-space" : "srgb", 24 | "components" : { 25 | "alpha" : "0.400", 26 | "blue" : "0x00", 27 | "green" : "0x00", 28 | "red" : "0x00" 29 | } 30 | }, 31 | "idiom" : "universal" 32 | } 33 | ], 34 | "info" : { 35 | "author" : "xcode", 36 | "version" : 1 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/Appearance/Appearance.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // Appearance.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 23/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | enum Appearance { 24 | enum Cell { 25 | static let leftMargin: CGFloat = 20.0 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Utils/Extensions/UIScrollView+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // UIViewController+Extension.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 12/10/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | internal extension UIScrollView { 24 | var lbbsContentHeight: CGFloat { contentInset.top + contentSize.height + contentInset.bottom } 25 | } 26 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Utils/Extensions/UIGestureRecognizer+Extensions.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // UIGestureRecognizer+Extensions.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 12/10/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | internal extension UIGestureRecognizer { 24 | func lbbsCancel() { 25 | isEnabled = false 26 | isEnabled = true 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/xcshareddata/IDETemplateMacros.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | FILEHEADER 6 | Copyright © ___YEAR___ Lunabee Studio 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); 9 | // you may not use this file except in compliance with the License. 10 | // You may obtain a copy of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, 16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | // See the License for the specific language governing permissions and 18 | // limitations under the License. 19 | // 20 | // ___FILENAME___ 21 | // LBBottomSheet 22 | // 23 | // Created by Lunabee Studio / Date - ___DATE___ - for the LBBottomSheet Swift Package. 24 | // 25 | 26 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo.xcodeproj/xcshareddata/IDETemplateMacros.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | FILEHEADER 6 | Copyright © ___YEAR___ Lunabee Studio 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); 9 | // you may not use this file except in compliance with the License. 10 | // You may obtain a copy of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, 16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | // See the License for the specific language governing permissions and 18 | // limitations under the License. 19 | // 20 | // ___FILENAME___ 21 | // LBBottomSheet-Demo 22 | // 23 | // Created by Lunabee Studio / Date - ___DATE___ - for the LBBottomSheet-Demo Swift Package. 24 | // 25 | 26 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Utils/Extensions/UIScreen+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // UIScreen+Extension.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 09/11/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | public extension UIScreen { 24 | var lbbsCornerRadius: CGFloat { 25 | guard let radius = UIScreen.main.value(forKey: ["Radius", "Corner", "display", "_"].reversed().joined()) as? CGFloat else { return 0.0 } 26 | return radius - 1.0 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Utils/Components/Extensions/UITableViewCell+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // UITableViewCell+Extension.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | extension UITableViewCell { 24 | 25 | func hideSeparator() { 26 | let width: CGFloat = UIScreen.main.bounds.width 27 | separatorInset = UIEdgeInsets(top: 0.0, left: width / 2.0, bottom: 0.0, right: width / 2.0) 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/Model/DemoTestCase.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // DemoText.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 26/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import Foundation 22 | import LBBottomSheet 23 | 24 | struct DemoTestCase { 25 | let title: String 26 | let menuTitle: String 27 | let explanations: String 28 | var codeUrl: URL? 29 | var theme: () -> BottomSheetController.Theme = { .init() } 30 | var behavior: () -> BottomSheetController.Behavior = { .init() } 31 | } 32 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/UI/XibName.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // XibName.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import Foundation 22 | 23 | enum XibName: String { 24 | case textCell = "TextCell" 25 | case imageCell = "ImageCell" 26 | case cardCell = "CardCell" 27 | case invertedCardCell = "InvertedCardCell" 28 | case swiftSectionCell = "SwiftSectionCell" 29 | case standardCell = "StandardCell" 30 | case imageCardCell = "ImageCardCell" 31 | } 32 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/Model/MenuEntry.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // MenuEntry.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 23/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | struct MenuEntry: Equatable { 24 | 25 | let title: String 26 | var isHeader: Bool = false 27 | var isFooter: Bool = false 28 | var subtitle: String? 29 | var isInverted: Bool = false 30 | var actionBlock: (() -> ())? 31 | 32 | static func == (lhs: MenuEntry, rhs: MenuEntry) -> Bool { 33 | lhs.title == rhs.title && lhs.subtitle == rhs.subtitle 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Utils/Components/Extensions/CACornerMask+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // CACornerMask+Extension.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | extension CACornerMask { 24 | 25 | static var all: CACornerMask { [.layerMinXMinYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMaxXMaxYCorner] } 26 | static var top: CACornerMask { [.layerMinXMinYCorner, .layerMaxXMinYCorner] } 27 | static var bottom: CACornerMask { [.layerMinXMaxYCorner, .layerMaxXMaxYCorner] } 28 | static var none: CACornerMask { [] } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Protocols/BottomSheetInteractionDelegate.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // BottomSheetInteractionDelegate.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 12/05/2022 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | /// Implement this protocol to get bottom sheet user's interactions. 24 | /// Only view controllers can implement this protocol. 25 | public protocol BottomSheetInteractionDelegate: UIViewController { 26 | /// This method is called when a tap is detected outside the bottom sheet (which makes it dimsissing). 27 | /// This way you can run some custom actions when this will happen. 28 | func bottomSheetInteractionDidTapOutside() 29 | } 30 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Utils/Components/Extensions/URL+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // URL+Extension.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 24/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | import SafariServices 23 | 24 | extension URL { 25 | func openInSafari(inApp: Bool = true, from controller: UIViewController? = nil) { 26 | if inApp { 27 | let safariController: SFSafariViewController = .init(url: self) 28 | controller?.present(safariController, animated: true) 29 | } else { 30 | if UIApplication.shared.canOpenURL(self) { UIApplication.shared.open(self) } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/Colors/tableViewBackground.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "0.965", 9 | "green" : "0.949", 10 | "red" : "0.945" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | }, 15 | { 16 | "appearances" : [ 17 | { 18 | "appearance" : "luminosity", 19 | "value" : "light" 20 | } 21 | ], 22 | "color" : { 23 | "color-space" : "srgb", 24 | "components" : { 25 | "alpha" : "1.000", 26 | "blue" : "0.965", 27 | "green" : "0.949", 28 | "red" : "0.945" 29 | } 30 | }, 31 | "idiom" : "universal" 32 | }, 33 | { 34 | "appearances" : [ 35 | { 36 | "appearance" : "luminosity", 37 | "value" : "dark" 38 | } 39 | ], 40 | "color" : { 41 | "color-space" : "srgb", 42 | "components" : { 43 | "alpha" : "1.000", 44 | "blue" : "0.118", 45 | "green" : "0.110", 46 | "red" : "0.110" 47 | } 48 | }, 49 | "idiom" : "universal" 50 | } 51 | ], 52 | "info" : { 53 | "author" : "xcode", 54 | "version" : 1 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Utils/Extensions/UIApplication+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // UIApplication+Extensions.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 12/10/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | internal extension UIApplication { 24 | /// This will return the first connected scene key window of the main screen if it exists. 25 | var lbbsKeySceneWindow: UIWindow? { 26 | if #available(iOS 13.0, *) { 27 | return UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene } 28 | .filter { $0.screen === UIScreen.main } 29 | .first?.windows 30 | .filter { $0.isKeyWindow }.first ?? UIApplication.shared.keyWindow 31 | } else { 32 | return UIApplication.shared.keyWindow 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Protocols/BottomSheetPositionDelegate.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // BottomSheetPositionDelegate.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 12/10/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | /// Implement this protocol to dynamically get bottom sheet offset changes. 24 | /// Only view controllers can implement this protocol. 25 | public protocol BottomSheetPositionDelegate: UIViewController { 26 | /// This method is called at each bottom sheet offset change during the layout process. 27 | /// This way you can dynamically align the components being at the bottom of the controller behind the bottom sheet. 28 | /// - Parameters: 29 | /// - y: This is the vertical bottom sheet coordinate (0.0 behing the top of the screen). 30 | func bottomSheetPositionDidUpdate(y: CGFloat) 31 | } 32 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/Coordinator/WindowedCoordinator.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // WindowedCoordinator.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | protocol WindowedCoordinator: Coordinator { 24 | 25 | var window: UIWindow! { get set } 26 | 27 | func createWindow(for controller: UIViewController) 28 | 29 | } 30 | 31 | extension WindowedCoordinator { 32 | 33 | func createWindow(for controller: UIViewController) { 34 | window = UIWindow(frame: UIScreen.main.bounds) 35 | window?.backgroundColor = .black 36 | window?.rootViewController = controller 37 | window?.alpha = 0.0 38 | window?.accessibilityViewIsModal = true 39 | window?.makeKeyAndVisible() 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Utils/Components/Extensions/UIView+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // UIView+Extension.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 23/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | extension UIView { 24 | func addConstrainedSubview(_ subview: UIView, insets: UIEdgeInsets = .zero) { 25 | addSubview(subview) 26 | subview.translatesAutoresizingMaskIntoConstraints = false 27 | subview.topAnchor.constraint(equalTo: topAnchor, constant: insets.top).isActive = true 28 | subview.bottomAnchor.constraint(equalTo: bottomAnchor, constant: insets.bottom).isActive = true 29 | subview.leadingAnchor.constraint(equalTo: leadingAnchor, constant: insets.left).isActive = true 30 | subview.trailingAnchor.constraint(equalTo: trailingAnchor, constant: insets.right).isActive = true 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Resources/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Icon-App-20x20@2x.png", 5 | "idiom" : "iphone", 6 | "scale" : "2x", 7 | "size" : "20x20" 8 | }, 9 | { 10 | "filename" : "Icon-App-20x20@3x.png", 11 | "idiom" : "iphone", 12 | "scale" : "3x", 13 | "size" : "20x20" 14 | }, 15 | { 16 | "filename" : "Icon-App-29x29@2x.png", 17 | "idiom" : "iphone", 18 | "scale" : "2x", 19 | "size" : "29x29" 20 | }, 21 | { 22 | "filename" : "Icon-App-29x29@3x.png", 23 | "idiom" : "iphone", 24 | "scale" : "3x", 25 | "size" : "29x29" 26 | }, 27 | { 28 | "filename" : "Icon-App-40x40@2x.png", 29 | "idiom" : "iphone", 30 | "scale" : "2x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "filename" : "Icon-App-40x40@3x.png", 35 | "idiom" : "iphone", 36 | "scale" : "3x", 37 | "size" : "40x40" 38 | }, 39 | { 40 | "filename" : "Icon-App-60x60@2x.png", 41 | "idiom" : "iphone", 42 | "scale" : "2x", 43 | "size" : "60x60" 44 | }, 45 | { 46 | "filename" : "Icon-App-60x60@3x.png", 47 | "idiom" : "iphone", 48 | "scale" : "3x", 49 | "size" : "60x60" 50 | }, 51 | { 52 | "filename" : "ItunesArtwork@2x.png", 53 | "idiom" : "ios-marketing", 54 | "scale" : "1x", 55 | "size" : "1024x1024" 56 | } 57 | ], 58 | "info" : { 59 | "author" : "xcode", 60 | "version" : 1 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Utils/Extensions/CACornerMask+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // CACornerMask+Extensions.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 12/10/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | public extension CACornerMask { 24 | static var lbbsAll: CACornerMask { [.layerMinXMinYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMaxXMaxYCorner] } 25 | static var lbbsTop: CACornerMask { [.layerMinXMinYCorner, .layerMaxXMinYCorner] } 26 | static var lbbsBottom: CACornerMask { [.layerMinXMaxYCorner, .layerMaxXMaxYCorner] } 27 | static var lbbsNone: CACornerMask { [] } 28 | 29 | static var lbbsTopLeft: CACornerMask { .layerMinXMinYCorner } 30 | static var lbbsTopRight: CACornerMask { .layerMaxXMinYCorner } 31 | static var lbbsBottomLeft: CACornerMask { .layerMinXMaxYCorner } 32 | static var lbbsBottomRight: CACornerMask { .layerMaxXMaxYCorner } 33 | } 34 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Utils/Components/CVForm/CVRowsBuilder.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // CVRowsBuilder.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import Foundation 22 | 23 | @resultBuilder 24 | struct CVRowsBuilder { 25 | static func buildBlock(_ rows: CVRowConvertible...) -> [CVRow] { rows.flatMap { $0.asRows() } } 26 | static func buildIf(_ value: CVRowConvertible?) -> CVRowConvertible { value ?? [] } 27 | static func buildEither(first: CVRowConvertible) -> CVRowConvertible { first } 28 | static func buildEither(second: CVRowConvertible) -> CVRowConvertible { second } 29 | } 30 | 31 | protocol CVRowConvertible { 32 | func asRows() -> [CVRow] 33 | } 34 | 35 | extension CVRow: CVRowConvertible { 36 | func asRows() -> [CVRow] { [self] } 37 | } 38 | 39 | extension Array: CVRowConvertible where Element == CVRow { 40 | func asRows() -> [CVRow] { self } 41 | } 42 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/Coordinator/Coordinator.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // Coordinator.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | protocol Coordinator: AnyObject { 24 | 25 | var parent: Coordinator? { get set } 26 | var childCoordinators: [Coordinator] { get set } 27 | 28 | func addChild(coordinator: Coordinator) 29 | func removeChild(coordinator: Coordinator) 30 | func didDeinit() 31 | 32 | } 33 | 34 | // MARK: - Children management - 35 | extension Coordinator { 36 | 37 | func addChild(coordinator: Coordinator) { 38 | childCoordinators.append(coordinator) 39 | } 40 | 41 | func removeChild(coordinator: Coordinator) { 42 | childCoordinators = childCoordinators.filter { $0 !== coordinator } 43 | } 44 | 45 | func didDeinit() { 46 | parent?.removeChild(coordinator: self) 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/UI/Common/Cells/SwiftSection/SwiftSectionCell.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // SwiftSectionCell.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | class SwiftSectionCell: CVTableViewCell { 24 | @IBOutlet var containerView: UIView! 25 | @IBOutlet var containerBackgroundView: UIView! 26 | @IBOutlet var rightImageView: UIImageView! 27 | 28 | override func setup(with row: CVRow) { 29 | super.setup(with: row) 30 | rightImageView.image = row.image 31 | containerBackgroundView.backgroundColor = backgroundColor 32 | containerBackgroundView.layer.cornerRadius = 10.0 33 | containerBackgroundView.layer.masksToBounds = true 34 | containerBackgroundView.layer.maskedCorners = row.theme.maskedCorners 35 | containerView.layer.cornerRadius = 10.0 36 | containerView.layer.masksToBounds = true 37 | containerView.layer.maskedCorners = row.theme.maskedCorners 38 | backgroundColor = .clear 39 | selectionStyle = .none 40 | accessoryType = .none 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/Appearance/UIColor+Appearance.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // UIColor+Appearance.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | extension UIColor { 24 | static var tableViewBackground: UIColor { UIColor(named: "tableViewBackground")! } 25 | static var buttonBackground: UIColor { UIColor(named: "buttonBackground")! } 26 | static var blurContainerBackground: UIColor { UIColor(named: "blurContainerBackground")! } 27 | static var shadow: UIColor { UIColor(named: "shadow")! } 28 | 29 | static var titleColor: UIColor { 30 | if #available(iOS 13, *) { 31 | return .label 32 | } else { 33 | return .black 34 | } 35 | } 36 | 37 | static var subtitleColor: UIColor { 38 | if #available(iOS 13, *) { 39 | return .secondaryLabel 40 | } else { 41 | return .darkGray 42 | } 43 | } 44 | 45 | static var accessoryColor: UIColor { 46 | if #available(iOS 13, *) { 47 | return .tertiaryLabel 48 | } else { 49 | return .lightGray 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Utils/Extensions/Mirror+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // Mirror+Extension.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 14/10/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import Foundation 22 | 23 | internal extension Mirror { 24 | static func lbbsGetTypesOfProperties(in class: NSObject.Type) -> [String]? { 25 | var count: UInt32 = UInt32() 26 | guard let properties = class_copyPropertyList(`class`, &count) else { return nil } 27 | var names: [String] = [] 28 | for i in 0.. Bool { 37 | let propertiesName: [String] = lbbsGetTypesOfProperties(in: `class`) ?? [] 38 | return propertiesName.contains(BottomSheetConstant.preferredHeightVariableName) 39 | } 40 | } 41 | 42 | private extension Mirror { 43 | static func lbbsGetNameOf(property: objc_property_t) -> String? { 44 | guard let name: NSString = NSString(utf8String: property_getName(property)) else { return nil } 45 | return name as String 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Utils/Extensions/UIColor+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // UIColor+Extensions.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 12/10/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | public extension UIColor { 24 | static var lbbsDefaultDimmingBackgroundColor: UIColor { 25 | if #available(iOS 13.0, *) { 26 | return UIColor.init(dynamicProvider: { 27 | switch $0.userInterfaceStyle { 28 | case .dark: 29 | return .white.withAlphaComponent(0.1) 30 | default: 31 | return .black.withAlphaComponent(0.4) 32 | } 33 | }) 34 | } else { 35 | return .black.withAlphaComponent(0.4) 36 | } 37 | } 38 | static var lbbsDefaultShadowColor: UIColor { 39 | if #available(iOS 13.0, *) { 40 | return UIColor.init(dynamicProvider: { 41 | switch $0.userInterfaceStyle { 42 | case .dark: 43 | return .gray 44 | case .light, .unspecified: 45 | return .black 46 | @unknown default: 47 | return .black 48 | } 49 | }) 50 | } else { 51 | return .black 52 | } 53 | } 54 | static var lbbsDefaultGrabberColor: UIColor { 55 | if #available(iOS 13.0, *) { 56 | return .tertiaryLabel 57 | } else { 58 | return .lightGray 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/BottomSheetConstant.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // BottomSheetConstant.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 12/10/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import CoreGraphics 22 | 23 | /// Bottom sheet constants. 24 | public enum BottomSheetConstant { 25 | /// Bottom sheet animation constants. 26 | public enum Animation { 27 | /// Bottom sheet animation elasticity functions. 28 | public enum Elasticity { 29 | /// Bottom sheet logarithmic animation function. 30 | /// 31 | /// Here is the implementation of this function: 32 | /// ```swift 33 | /// let baseFunction: (_ x: CGFloat) -> CGFloat = { (2.0 * log($0 + 3.0) / log(2.0)) } 34 | /// return baseFunction(x) - baseFunction(0.0) 35 | /// ``` 36 | /// 37 | /// - Parameters: 38 | /// - x: The abscissa: The bottom sheet will give the height slice that has to be computed to create the elacticity effect. 39 | /// - Returns: The ordonate: The height value to be applied to be used by the bottom sheet to calculate its full height. 40 | public static let logarithmic: (_ x: CGFloat) -> CGFloat = { x -> CGFloat in 41 | let baseFunction: (_ x: CGFloat) -> CGFloat = { (2.0 * log($0 + 3.0) / log(2.0)) } 42 | return baseFunction(x) - baseFunction(0.0) 43 | } 44 | } 45 | } 46 | 47 | internal static let preferredHeightVariableName: String = "preferredHeightInBottomSheet" 48 | } 49 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Utils/Extensions/UIView+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // UIView+Extension.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 14/10/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | internal extension UIView { 24 | func lbbsAddFullSubview(_ subview: UIView, belowSubview: UIView? = nil) { 25 | if let belowSubview = belowSubview { 26 | insertSubview(subview, belowSubview: belowSubview) 27 | } else { 28 | addSubview(subview) 29 | } 30 | subview.translatesAutoresizingMaskIntoConstraints = false 31 | subview.topAnchor.constraint(equalTo: topAnchor, constant: 0.0).isActive = true 32 | subview.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0.0).isActive = true 33 | subview.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 0.0).isActive = true 34 | subview.trailingAnchor.constraint(equalTo: trailingAnchor, constant: 0.0).isActive = true 35 | } 36 | 37 | func lbbsGetSubviews() -> [T] { 38 | var foundSubviews: [T] = [] 39 | if let subview = self as? T { foundSubviews.append(subview) } 40 | self.subviews.forEach { 41 | foundSubviews += $0.lbbsGetSubviews() as [T] 42 | if let subview = $0 as? T { foundSubviews.append(subview) } 43 | } 44 | return foundSubviews 45 | } 46 | 47 | func lbbsGetFirstTableOrCollectionView() -> UIScrollView? { 48 | let tableViews: [UITableView] = lbbsGetSubviews() 49 | let collectionViews: [UICollectionView] = lbbsGetSubviews() 50 | return tableViews.first ?? collectionViews.first 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/UI/Common/Cells/InvertedCard/InvertedCardCell.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // InvertedCardCell.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | class InvertedCardCell: CVTableViewCell { 24 | @IBOutlet var containerView: UIView! 25 | @IBOutlet var containerBackgroundView: UIView! 26 | @IBOutlet var fakeTitleLabel: UILabel! 27 | 28 | override func setup(with row: CVRow) { 29 | super.setup(with: row) 30 | containerBackgroundView.backgroundColor = backgroundColor 31 | containerBackgroundView.layer.cornerRadius = 10.0 32 | containerBackgroundView.layer.masksToBounds = true 33 | containerBackgroundView.layer.maskedCorners = row.theme.maskedCorners 34 | containerView.layer.cornerRadius = 10.0 35 | containerView.layer.masksToBounds = true 36 | containerView.layer.maskedCorners = row.theme.maskedCorners 37 | fakeTitleLabel.text = cvTitleLabel?.text 38 | fakeTitleLabel.font = cvTitleLabel?.font 39 | backgroundColor = .clear 40 | selectionStyle = .none 41 | accessoryType = .none 42 | } 43 | 44 | override func setHighlighted(_ highlighted: Bool, animated: Bool) { 45 | guard currentAssociatedRow?.selectionAction != nil else { return } 46 | super.setHighlighted(highlighted, animated: animated) 47 | if highlighted { 48 | containerBackgroundView.layer.removeAllAnimations() 49 | containerBackgroundView.alpha = 0.6 50 | } else { 51 | UIView.animate(withDuration: 0.3) { 52 | self.containerBackgroundView.alpha = 1.0 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/UI/Common/Cells/Card/CardCell.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // CardCell.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | class CardCell: CVTableViewCell { 24 | @IBOutlet var containerView: UIView! 25 | @IBOutlet var containerBackgroundView: UIView! 26 | @IBOutlet var fakeSubtitleLabel: UILabel? 27 | @IBOutlet var subtitleView: UIView? 28 | 29 | override func setup(with row: CVRow) { 30 | super.setup(with: row) 31 | containerBackgroundView.backgroundColor = backgroundColor 32 | containerBackgroundView.layer.cornerRadius = 10.0 33 | containerBackgroundView.layer.masksToBounds = true 34 | containerBackgroundView.layer.maskedCorners = row.theme.maskedCorners 35 | containerView.layer.cornerRadius = 10.0 36 | containerView.layer.masksToBounds = true 37 | containerView.layer.maskedCorners = row.theme.maskedCorners 38 | fakeSubtitleLabel?.text = cvSubtitleLabel?.text 39 | fakeSubtitleLabel?.font = cvSubtitleLabel?.font 40 | subtitleView?.isHidden = row.subtitle == nil 41 | backgroundColor = .clear 42 | selectionStyle = .none 43 | accessoryType = .none 44 | } 45 | 46 | override func setHighlighted(_ highlighted: Bool, animated: Bool) { 47 | guard currentAssociatedRow?.selectionAction != nil else { return } 48 | super.setHighlighted(highlighted, animated: animated) 49 | if highlighted { 50 | containerBackgroundView.layer.removeAllAnimations() 51 | containerBackgroundView.alpha = 0.6 52 | } else { 53 | UIView.animate(withDuration: 0.3) { 54 | self.containerBackgroundView.alpha = 1.0 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | LBBottomSheet-Demo/.DS_Store 92 | .DS_Store 93 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Utils/Components/CVForm/CVRow.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // CVRow.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | struct CVRow { 24 | 25 | struct Theme { 26 | var backgroundColor: UIColor? 27 | var topInset: CGFloat? 28 | var bottomInset: CGFloat? 29 | var leftInset: CGFloat? 30 | var rightInset: CGFloat? 31 | var textAlignment: NSTextAlignment = .center 32 | var titleFont: (() -> UIFont) = { UIFont.systemFont(ofSize: 17.0) } 33 | var titleColor: UIColor = .titleColor 34 | var titleLinesCount: Int? 35 | var subtitleFont: (() -> UIFont) = { UIFont.systemFont(ofSize: 15.0) } 36 | var subtitleColor: UIColor = .subtitleColor 37 | var subtitleLinesCount: Int? 38 | var accessoryTextFont: (() -> UIFont?)? 39 | var accessoryTextColor: UIColor = .accessoryColor 40 | var imageTintColor: UIColor? 41 | var imageSize: CGSize? 42 | var imageRatio: CGFloat? 43 | var separatorLeftInset: CGFloat? 44 | var separatorRightInset: CGFloat? 45 | var maskedCorners: CACornerMask = .all 46 | } 47 | 48 | var title: String? 49 | var subtitle: String? 50 | var placeholder: String? 51 | var accessoryText: String? 52 | var footerText: String? 53 | var image: UIImage? 54 | var secondaryImage: UIImage? 55 | var xibName: XibName 56 | var theme: Theme = Theme() 57 | var enabled: Bool = true 58 | var associatedValue: Any? = nil 59 | var selectionActionWithCell: ((_ cell: CVTableViewCell) -> ())? 60 | var selectionAction: (() -> ())? 61 | var secondarySelectionAction: (() -> ())? 62 | var tertiarySelectionAction: (() -> ())? 63 | var quaternarySelectionAction: (() -> ())? 64 | var quinarySelectionAction: (() -> ())? 65 | var senarySelectionAction: (() -> ())? 66 | var willDisplay: ((_ cell: CVTableViewCell) -> ())? 67 | 68 | } 69 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Utils/Components/ForwardingEventsView.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // ForwardingEventsView.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 12/10/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | /// This view implementation makes us able to forward events not happening on the bottom sheet itself to the controller behind the bottom sheet. 24 | final class ForwardingEventsView: UIView { 25 | 26 | /// The view which must be the destination of the detected touch events. 27 | var destinationView: UIView? 28 | /// This is the view for which (children included) we must not forward the touch event to the view behind it. 29 | var excludedParentView: UIView? 30 | 31 | override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { 32 | // Here we get the original result of the hit test. 33 | let hitTest: UIView? = super.hitTest(point, with: event) 34 | 35 | // We will recursivly go up along the hitTest result superviews to detect if the touched view is the excluded one or contained in the excluded one. 36 | // Recursively, each superview will be stored in currentView. 37 | var currentView: UIView? = hitTest 38 | var isChildOfExcludedParentView: Bool = hitTest == excludedParentView 39 | 40 | // Now we will go up along the superviews until the root one to check if the touched view is not contained in the excluded one. 41 | while let superview = currentView?.superview { 42 | currentView = superview 43 | if currentView == excludedParentView { 44 | isChildOfExcludedParentView = true 45 | break 46 | } 47 | } 48 | 49 | if isChildOfExcludedParentView { 50 | // In the case the touch event was made on the excluded view or on one of its children, we don't forward the touch event to the view behind, so we keep the initial hit test result. 51 | return hitTest 52 | } else { 53 | // If we didn't find the excluded view in the touched view hierarchy, we forward the hitTest to the destination view which can be, for example, the view of the controller being behind the bottom sheet. 54 | // If no destination view was defined, we just return the initial hit test result. 55 | let destinationPoint: CGPoint = convert(point, to: destinationView) 56 | return destinationView?.hitTest(destinationPoint, with: event) ?? hitTest 57 | } 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/Coordinator/Root/RootCoordinator.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // RootCoordinator.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | final class RootCoordinator: Coordinator { 24 | 25 | enum State { 26 | case main 27 | case unknown 28 | } 29 | 30 | weak var parent: Coordinator? 31 | var childCoordinators: [Coordinator] = [] 32 | 33 | private var state: State = .unknown 34 | private weak var currentCoordinator: WindowedCoordinator? 35 | 36 | func start() { 37 | switchTo(state: .main) 38 | } 39 | 40 | private func switchTo(state: State) { 41 | self.state = state 42 | if let newCoordinator: WindowedCoordinator = coordinator(for: state) { 43 | if currentCoordinator != nil { 44 | processCrossFadingAnimation(newCoordinator: newCoordinator) 45 | } else { 46 | currentCoordinator = newCoordinator 47 | currentCoordinator?.window.alpha = 1.0 48 | addChild(coordinator: newCoordinator) 49 | } 50 | } else { 51 | childCoordinators.removeAll() 52 | } 53 | } 54 | 55 | private func coordinator(for state: State) -> WindowedCoordinator? { 56 | let coordinator: WindowedCoordinator? 57 | switch state { 58 | case .main: 59 | coordinator = MainCoordinator(parent: self) 60 | default: 61 | return nil 62 | } 63 | return coordinator 64 | } 65 | 66 | } 67 | 68 | extension RootCoordinator { 69 | 70 | private func processCrossFadingAnimation(newCoordinator: WindowedCoordinator) { 71 | guard let currentCoordinator = currentCoordinator else { return } 72 | newCoordinator.window.transform = CGAffineTransform(scaleX: 0.9, y: 0.9) 73 | UIView.animate(withDuration: 0.3, animations: { 74 | newCoordinator.window.alpha = 1.0 75 | newCoordinator.window.transform = .identity 76 | currentCoordinator.window.transform = CGAffineTransform(scaleX: 0.9, y: 0.9) 77 | currentCoordinator.window.alpha = 0.0 78 | }) { _ in 79 | currentCoordinator.window?.isHidden = true 80 | currentCoordinator.window?.resignKey() 81 | currentCoordinator.window = nil 82 | self.currentCoordinator = newCoordinator 83 | self.removeChild(coordinator: currentCoordinator) 84 | self.addChild(coordinator: newCoordinator) 85 | } 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo.xcodeproj/xcshareddata/xcschemes/LBBottomSheet-Demo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/Coordinator/Main/MainCoordinator.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // HomeCoordinator.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | final class MainCoordinator: WindowedCoordinator { 24 | 25 | weak var parent: Coordinator? 26 | var childCoordinators: [Coordinator] 27 | var window: UIWindow! 28 | 29 | // private weak var navigationController: UINavigationController? 30 | private weak var launchScreenController: UIViewController? 31 | private var launchScreenWindow: UIWindow? 32 | 33 | init(parent: Coordinator) { 34 | self.parent = parent 35 | self.childCoordinators = [] 36 | start() 37 | } 38 | 39 | private func start() { 40 | let controller: UIViewController = MainViewController(didFinishLoading: { [weak self] headerImageView in 41 | if let headerImageView = headerImageView { 42 | self?.animateLaunchScreen(headerImageView: headerImageView) 43 | } else { 44 | self?.hideLaunchScreen() 45 | } 46 | }) 47 | // let navigationController: UINavigationController = UINavigationController(rootViewController: controller) 48 | // self.navigationController = navigationController 49 | // createWindow(for: navigationController) 50 | createWindow(for: controller) 51 | loadLaunchScreen() 52 | } 53 | 54 | } 55 | 56 | extension MainCoordinator { 57 | 58 | private func loadLaunchScreen() { 59 | guard let launchScreen = UIStoryboard(name: "LaunchScreen", bundle: nil).instantiateInitialViewController() else { return } 60 | self.launchScreenController = launchScreen 61 | let window: UIWindow = UIWindow(frame: UIScreen.main.bounds) 62 | launchScreenWindow = window 63 | window.windowLevel = .statusBar 64 | window.rootViewController = launchScreen 65 | window.makeKeyAndVisible() 66 | } 67 | 68 | private func hideLaunchScreen() { 69 | UIView.animate(withDuration: 0.3, animations: { 70 | self.launchScreenWindow?.alpha = 0.0 71 | }) { _ in 72 | self.launchScreenWindow?.resignKey() 73 | self.launchScreenWindow = nil 74 | self.window.makeKeyAndVisible() 75 | } 76 | } 77 | 78 | private func animateLaunchScreen(headerImageView: UIImageView) { 79 | guard let launchScreenImageView = launchScreenController?.view.viewWithTag(99) as? UIImageView else { return } 80 | let originRect: CGRect = window.convert(launchScreenImageView.frame, from: launchScreenImageView.superview) 81 | let destinationRect: CGRect = window.convert(headerImageView.frame, from: headerImageView.superview) 82 | let translationY: CGFloat = destinationRect.midY - originRect.midY 83 | UIView.animate(withDuration: 1.0, 84 | delay: 0.0, 85 | usingSpringWithDamping: 0.8, 86 | initialSpringVelocity: 0.1, 87 | options: [.curveEaseInOut]) { 88 | launchScreenImageView.transform = CGAffineTransform(translationX: 0.0, y: translationY) 89 | } completion: { [weak self] _ in 90 | self?.hideLaunchScreen() 91 | } 92 | 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/UI/Common/Cells/Image/ImageCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/UI/Demo/DemoViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // DemoViewController.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 26/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | import LBBottomSheet 23 | 24 | final class DemoViewController: CVTableViewController { 25 | 26 | private let demoTitle: String 27 | private let explanations: String 28 | private let codeUrl: URL? 29 | 30 | init(demoTitle: String, explanations: String, codeUrl: URL?) { 31 | self.demoTitle = demoTitle 32 | self.explanations = explanations 33 | self.codeUrl = codeUrl 34 | super.init(style: .plain) 35 | } 36 | 37 | required init?(coder: NSCoder) { 38 | fatalError("init(coder:) has not been implemented") 39 | } 40 | 41 | override func viewDidLoad() { 42 | super.viewDidLoad() 43 | initTableView() 44 | reloadUI() 45 | } 46 | 47 | override func createRows() -> [CVRow] { 48 | makeRows { 49 | titleRow() 50 | explanationsRow() 51 | if codeUrl != nil { codeUrlRow() } 52 | } 53 | } 54 | 55 | private func initTableView() { 56 | let isGrabberBackgroundTranslucent: Bool = bottomSheetController?.theme.grabber?.background.isTranslucent ?? true 57 | let headerHeight: CGFloat = isGrabberBackgroundTranslucent ? bottomSheetController?.topInset ?? 0.0 : 0.0 58 | addHeaderView(height: headerHeight) 59 | tableView.backgroundColor = .tableViewBackground 60 | } 61 | } 62 | 63 | private extension DemoViewController { 64 | func titleRow() -> CVRow { 65 | CVRow(title: demoTitle, 66 | xibName: .textCell, 67 | theme: CVRow.Theme(backgroundColor: .clear, 68 | topInset: 0.0, 69 | bottomInset: 15.0, 70 | textAlignment: .center, 71 | titleFont: { UIFont.systemFont(ofSize: 30.0, weight: .semibold) })) 72 | } 73 | 74 | func explanationsRow() -> CVRow { 75 | let subtitleColor: UIColor 76 | if #available(iOS 13, *) { 77 | subtitleColor = .label 78 | } else { 79 | subtitleColor = .black 80 | } 81 | return CVRow(subtitle: explanations, 82 | xibName: .textCell, 83 | theme: CVRow.Theme(backgroundColor: .clear, 84 | topInset: 0.0, 85 | bottomInset: 0.0, 86 | leftInset: Appearance.Cell.leftMargin, 87 | rightInset: Appearance.Cell.leftMargin, 88 | textAlignment: .natural, 89 | subtitleColor: subtitleColor)) 90 | } 91 | 92 | func codeUrlRow() -> CVRow { 93 | CVRow(title: "See configuration code", 94 | image: UIImage(named: "swift"), 95 | xibName: .swiftSectionCell, 96 | theme: CVRow.Theme(backgroundColor: .buttonBackground, 97 | topInset: 20.0, 98 | bottomInset: 0.0, 99 | leftInset: Appearance.Cell.leftMargin, 100 | rightInset: Appearance.Cell.leftMargin, 101 | textAlignment: .center, 102 | maskedCorners: .all), 103 | selectionAction: { [weak self] in 104 | guard let self = self else { return } 105 | let githubAppUrl: URL = URL(string: "github://")! 106 | self.codeUrl?.openInSafari(inApp: UIApplication.shared.canOpenURL(githubAppUrl), from: self) 107 | }) 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Utils/Components/CVForm/CVTableViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // CVTableViewController.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | class CVTableViewController: UITableViewController { 24 | 25 | var rows: [CVRow] = [] 26 | private var cellHeights: [IndexPath: CGFloat] = [:] 27 | 28 | override func viewDidLoad() { 29 | super.viewDidLoad() 30 | addHeaderView() 31 | addFooterView() 32 | tableView.showsVerticalScrollIndicator = false 33 | tableView.backgroundColor = UIColor(named: "cardTableViewBackground") 34 | } 35 | 36 | func createRows() -> [CVRow] { [] } 37 | func makeRows(@CVRowsBuilder _ content: () -> [CVRow]) -> [CVRow] { content() } 38 | 39 | func reloadUI(animated: Bool = false, animatedView: UIView? = nil, completion: (() -> ())? = nil) { 40 | rows = createRows() 41 | registerXibs() 42 | if #available(iOS 13.0, *) { 43 | if animated { 44 | UIView.transition(with: animatedView ?? tableView, duration: 0.2, options: [.transitionCrossDissolve], animations: { 45 | self.tableView.reloadData() 46 | }) { _ in 47 | completion?() 48 | } 49 | } else { 50 | tableView.reloadData() 51 | completion?() 52 | } 53 | } else { 54 | tableView.reloadData() 55 | completion?() 56 | } 57 | } 58 | 59 | func rowObject(at indexPath: IndexPath) -> CVRow { 60 | rows[indexPath.row] 61 | } 62 | 63 | private func registerXibs() { 64 | var xibNames: Set = Set() 65 | rows.forEach { xibNames.insert($0.xibName.rawValue) } 66 | xibNames.forEach{ tableView.register(UINib(nibName: $0, bundle: nil), forCellReuseIdentifier: $0) } 67 | } 68 | 69 | override func numberOfSections(in tableView: UITableView) -> Int { 1 } 70 | 71 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 72 | rows.count 73 | } 74 | 75 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 76 | let row: CVRow = rowObject(at: indexPath) 77 | let identifier: String = row.xibName.rawValue 78 | let cell: CVTableViewCell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath) as! CVTableViewCell 79 | cell.setup(with: row) 80 | cell.layoutSubviews() 81 | return cell 82 | } 83 | 84 | override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { 85 | cellHeights[indexPath] = cell.frame.size.height 86 | guard let cell = cell as? CVTableViewCell else { return } 87 | let row: CVRow = rowObject(at: indexPath) 88 | row.willDisplay?(cell) 89 | } 90 | 91 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 92 | tableView.deselectRow(at: indexPath, animated: true) 93 | let row: CVRow = rowObject(at: indexPath) 94 | row.selectionAction?() 95 | } 96 | 97 | override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { 98 | cellHeights[indexPath] ?? UITableView.automaticDimension 99 | } 100 | 101 | 102 | override func accessibilityPerformEscape() -> Bool { 103 | if let navigationController = navigationController, navigationController.viewControllers.first !== self { 104 | navigationController.popViewController(animated: true) 105 | } else { 106 | dismiss(animated: true) 107 | } 108 | return true 109 | } 110 | 111 | } 112 | 113 | // MARK: - Header/Bottom View Management- 114 | extension CVTableViewController { 115 | func addHeaderView(height: CGFloat = 0.0) { 116 | tableView.tableHeaderView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 0.0, height: height)) 117 | } 118 | 119 | func addFooterView(height: CGFloat = 20.0) { 120 | tableView.tableFooterView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 0.0, height: height)) 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/UI/Common/Cells/Standard/StandardCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/UI/Common/Cells/Text/TextCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 28 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Utils/Extensions/UIViewController+Extension.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // UIViewController+Extension.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 12/10/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | // MARK: - Public extensions - 24 | public extension UIViewController { 25 | /// Find the BottomSheetController embedding the current controller. 26 | /// It is working like `navigationController` or others. 27 | var bottomSheetController: BottomSheetController? { 28 | var parentController: UIViewController? = self 29 | while let controller = parentController?.parent { 30 | parentController = controller 31 | if parentController is BottomSheetController { 32 | break 33 | } 34 | } 35 | return parentController as? BottomSheetController 36 | } 37 | 38 | /// Presents a given controller as a bottom sheet. 39 | /// - Parameters: 40 | /// - controller: The controller to present in a bottom sheet. 41 | /// - positionDelegate: A `UIViewController` being a to get the bottom sheet position updates if it needs to update its content bottom inset. 42 | /// - theme: A Theme to customize the bottom sheet appearance. 43 | /// - behavior: A Behavior to customize the way the bottom sheet behaves. 44 | /// - Returns: A reference to the created `BottomSheetController`. 45 | @discardableResult 46 | func presentAsBottomSheet(_ controller: UIViewController, 47 | positionDelegate: BottomSheetPositionDelegate? = nil, 48 | bottomSheetInteractionDelegate: BottomSheetInteractionDelegate? = nil, 49 | theme: BottomSheetController.Theme = BottomSheetController.Theme(), 50 | behavior: BottomSheetController.Behavior = BottomSheetController.Behavior()) -> BottomSheetController { 51 | let bottomSheetController: BottomSheetController = .controller(bottomSheetChild: controller, 52 | bottomSheetPositionDelegate: positionDelegate, 53 | bottomSheetInteractionDelegate: bottomSheetInteractionDelegate, 54 | theme: theme, 55 | behavior: behavior) 56 | present(bottomSheetController, animated: false, completion: nil) 57 | return bottomSheetController 58 | } 59 | 60 | /// Use this function to dismiss the top presented bottom sheet. 61 | /// If the top presented controller is not a bottom sheet, nothing will happen. 62 | /// - Parameters: 63 | /// - completion: An optional completion handler to be called when the bottom sheet is dismissed. 64 | func dismissBottomSheet(_ completion: (() -> Void)? = nil) { 65 | guard let controller = lbbsTopPresentedController as? BottomSheetController else { 66 | completion?() 67 | return 68 | } 69 | controller.dismiss(completion) 70 | } 71 | } 72 | 73 | // MARK: - Internal extensions - 74 | internal extension UIViewController { 75 | var lbbsTopPresentedController: UIViewController { 76 | var presentedController: UIViewController = self 77 | while let controller = presentedController.presentedViewController { 78 | presentedController = controller 79 | } 80 | return presentedController 81 | } 82 | 83 | func lbbsRearControllerTopInset(includeNavigationBar: Bool = true) -> CGFloat { 84 | var topInset: CGFloat = UIApplication.shared.lbbsKeySceneWindow?.safeAreaInsets.top ?? 0.0 85 | if let navController = presentingViewController as? UINavigationController ?? presentingViewController?.navigationController, !navController.isNavigationBarHidden && includeNavigationBar { 86 | topInset = navController.navigationBar.frame.maxY + 8.0 87 | } 88 | return topInset 89 | } 90 | 91 | func lbbsAddChildViewController(_ childController: UIViewController, containerView: UIView) { 92 | addChild(childController) 93 | containerView.lbbsAddFullSubview(childController.view) 94 | childController.didMove(toParent: self) 95 | } 96 | 97 | func lbbsFindControllerDeclaringPreferredHeightInBottomSheet() -> UIViewController? { 98 | if Mirror.isPreferredHeightInBottomSheetDeclared(in: type(of: self)) { 99 | return self 100 | } else { 101 | return children.first { Mirror.isPreferredHeightInBottomSheetDeclared(in: type(of: $0)) } 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Utils/Components/CVForm/CVTableViewCell.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // CVTableViewCell.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 22/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | class CVTableViewCell: UITableViewCell { 24 | var currentAssociatedRow: CVRow? 25 | 26 | @IBOutlet var cvTitleLabel: UILabel? 27 | @IBOutlet var cvSubtitleLabel: UILabel? 28 | @IBOutlet var cvAccessoryLabel: UILabel? 29 | @IBOutlet var cvImageView: UIImageView? 30 | 31 | @IBOutlet private var leadingConstraint: NSLayoutConstraint? 32 | @IBOutlet private var trailingConstraint: NSLayoutConstraint? 33 | @IBOutlet private var topConstraint: NSLayoutConstraint? 34 | @IBOutlet private var bottomConstraint: NSLayoutConstraint? 35 | @IBOutlet private var imageWidthConstraint: NSLayoutConstraint? 36 | @IBOutlet private var imageHeightConstraint: NSLayoutConstraint? 37 | 38 | func setup(with row: CVRow) { 39 | currentAssociatedRow = row 40 | cvSubtitleLabel?.text = row.subtitle 41 | cvAccessoryLabel?.text = row.accessoryText 42 | cvImageView?.image = row.image 43 | cvImageView?.tintColor = row.theme.imageTintColor 44 | setupTheme(with: row) 45 | } 46 | 47 | private func setupTheme(with row: CVRow) { 48 | selectionStyle = row.selectionAction == nil ? .none : .default 49 | accessoryType = row.selectionAction == nil ? .none : .disclosureIndicator 50 | backgroundColor = row.theme.backgroundColor ?? .clear 51 | 52 | cvTitleLabel?.isHidden = row.title == nil 53 | cvTitleLabel?.textAlignment = row.theme.textAlignment 54 | cvTitleLabel?.adjustsFontForContentSizeCategory = true 55 | 56 | cvTitleLabel?.font = row.theme.titleFont() 57 | cvTitleLabel?.textColor = row.theme.titleColor 58 | cvTitleLabel?.text = row.title 59 | 60 | cvSubtitleLabel?.isHidden = row.subtitle == nil 61 | cvSubtitleLabel?.font = row.theme.subtitleFont() 62 | cvSubtitleLabel?.textColor = row.theme.subtitleColor 63 | cvSubtitleLabel?.textAlignment = row.theme.textAlignment 64 | cvSubtitleLabel?.adjustsFontForContentSizeCategory = true 65 | 66 | row.theme.titleLinesCount.map { cvTitleLabel?.numberOfLines = $0 } 67 | row.theme.subtitleLinesCount.map { cvSubtitleLabel?.numberOfLines = $0 } 68 | 69 | cvAccessoryLabel?.isHidden = row.accessoryText == nil 70 | cvAccessoryLabel?.font = row.theme.accessoryTextFont?() 71 | cvAccessoryLabel?.textColor = row.theme.accessoryTextColor 72 | cvAccessoryLabel?.textAlignment = row.theme.textAlignment 73 | cvAccessoryLabel?.adjustsFontForContentSizeCategory = true 74 | 75 | cvImageView?.isHidden = row.image == nil 76 | cvImageView?.tintAdjustmentMode = .normal 77 | 78 | leadingConstraint?.constant = row.theme.leftInset ?? 0.0 79 | trailingConstraint?.constant = row.theme.rightInset ?? 0.0 80 | if let topInset = row.theme.topInset { 81 | topConstraint?.constant = topInset 82 | } 83 | if let bottomInset = row.theme.bottomInset { 84 | bottomConstraint?.constant = bottomInset 85 | } 86 | if let imageWidthConstraint = imageWidthConstraint, let imageHeightConstraint = imageHeightConstraint { 87 | if let ratio = row.theme.imageRatio { 88 | if let imageView = cvImageView { 89 | let existingConstraint: NSLayoutConstraint? = imageView.constraints.filter { $0.firstAnchor == imageView.widthAnchor && $0.secondAnchor == imageView.heightAnchor }.first 90 | if let constraint = existingConstraint { 91 | imageView.removeConstraint(constraint) 92 | } 93 | imageView.widthAnchor.constraint(equalTo: imageView.heightAnchor, multiplier: ratio, constant: 0.0).isActive = true 94 | } 95 | imageHeightConstraint.isActive = false 96 | } else { 97 | if let imageView = cvImageView { 98 | let existingConstraint: NSLayoutConstraint? = imageView.constraints.filter { $0.firstAnchor == imageView.widthAnchor && $0.secondAnchor == imageView.heightAnchor }.first 99 | if let constraint = existingConstraint { 100 | imageView.removeConstraint(constraint) 101 | } 102 | } 103 | imageHeightConstraint.isActive = true 104 | } 105 | if let size = row.theme.imageSize { 106 | imageWidthConstraint.constant = size.width 107 | imageHeightConstraint.constant = size.height 108 | } 109 | } 110 | let leftInset: CGFloat? = row.theme.separatorLeftInset 111 | let rightInset: CGFloat? = row.theme.separatorRightInset 112 | if leftInset == nil && rightInset == nil { 113 | hideSeparator() 114 | } else { 115 | separatorInset = UIEdgeInsets(top: 0.0, left: leftInset ?? 0.0, bottom: 0.0, right: rightInset ?? 0.0) 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/UI/Common/Cells/ImageCardCell/ImageCardCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/Model/BottomSheetController+Theme.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // BottomSheetController+Theme.swift 16 | // LBBottomSheet 17 | // 18 | // Created by Lunabee Studio / Date - 12/10/2021 - for the LBBottomSheet Swift Package. 19 | // 20 | 21 | import UIKit 22 | 23 | extension BottomSheetController { 24 | /// Struct used to define the theme of a BottomSheetController. 25 | public struct Theme { 26 | /// Struct used to represent a grabber that can be added to a BottomSheetControllerTheme. 27 | /// It will be visible at the top of the BottomSheetController. 28 | /// ![Grabber](Grabber) 29 | public struct Grabber { 30 | /// An enum describing the available background types for the Grabber. 31 | /// ![GrabberBackground](GrabberBackground) 32 | public enum Background { 33 | /// Use a simple color as the grabber "zone" background. 34 | /// - Parameters: 35 | /// - color: The color to use as the grabber "zone" background. 36 | /// - isTranslucent: If `true`, the embedded view will be extended under the grabber "zone". Otherwise, the embedded view will have its top starting at the bottom of the grabber "zone". 37 | case color(_ color: UIColor = .clear, isTranslucent: Bool = true) 38 | /// Use a custom view as the grabber "zone" background. 39 | /// - Parameters: 40 | /// - view: The view to insert as the grabber "zone" background. 41 | /// - isTranslucent: If `true`, the embedded view will be extended under the grabber "zone". Otherwise, the embedded view will have its top starting at the bottom of the grabber "zone". 42 | case view(_ view: UIView, isTranslucent: Bool) 43 | 44 | /// This is a shorcut to easily know if the background is translucent or not. 45 | public var isTranslucent: Bool { 46 | switch self { 47 | case .color(_, let isTranslucent), .view(_, let isTranslucent): 48 | return isTranslucent 49 | } 50 | } 51 | } 52 | 53 | /// An enum describing the available corner radius types. 54 | public enum CornerRadiusType { 55 | /// The grabber corner radius will be the height of the grabber devided by 2. 56 | case rounded 57 | /// The grabber corner redius will be the given value. 58 | /// - Parameters: 59 | /// - value: The corner radius value. 60 | case fixed(_ value: CGFloat) 61 | } 62 | /// A Grabber configured to look like the Apple one. 63 | public static let appleDefault: Grabber = .init(size: CGSize(width: 36.0, height: 5.0), 64 | color: .lbbsDefaultGrabberColor, 65 | topMargin: 5.0) 66 | /// The size of the grabber. 67 | public var size: CGSize 68 | /// Defines whether or not the grabber shoiuld have a corner radius. 69 | public var cornerRadiusType: CornerRadiusType 70 | /// These are the corners to apply the radius to. 71 | public var maskedCorners: CACornerMask 72 | /// The grabber color. 73 | public var color: UIColor 74 | /// The margin between the grabber top and the top of the BottomSheetController view. 75 | public var topMargin: CGFloat 76 | /// Defines whether or not the BottomSheetController should be dismissed when tapping the grabber. 77 | public var canTouchToDismiss: Bool 78 | /// The background to use behind the grabber. By default it is transparent. 79 | public var background: Background 80 | 81 | /// Initializes a new Grabber. 82 | public init(size: CGSize = CGSize(width: 30.0, height: 4.0), 83 | cornerRadiusType: BottomSheetController.Theme.Grabber.CornerRadiusType = .rounded, 84 | maskedCorners: CACornerMask = .lbbsAll, 85 | color: UIColor = .lbbsDefaultGrabberColor, 86 | topMargin: CGFloat = 20.0, 87 | canTouchToDismiss: Bool = false, 88 | background: BottomSheetController.Theme.Grabber.Background = .color()) { 89 | self.size = size 90 | self.cornerRadiusType = cornerRadiusType 91 | self.maskedCorners = maskedCorners 92 | self.color = color 93 | self.topMargin = topMargin 94 | self.canTouchToDismiss = canTouchToDismiss 95 | self.background = background 96 | } 97 | } 98 | 99 | /// Struct used to represent a shadow that can be added to a BottomSheetControllerTheme. 100 | /// It will then appear behind the top of the BottomSheetController. 101 | /// ![Shadow](Shadow) 102 | public struct Shadow { 103 | /// The color of the shadow. 104 | public var color: UIColor 105 | /// The opacity of the shadow. Specifying a value outside the [0,1] range will give undefined results. 106 | public var opacity: Float 107 | /// The shadow offset. 108 | public var offset: CGSize 109 | /// The blur radius used to create the shadow. 110 | public var radius: CGFloat 111 | 112 | /// Initializes a new Shadow. 113 | public init(color: UIColor = .lbbsDefaultShadowColor, 114 | opacity: Float = 0.3, 115 | offset: CGSize = .zero, 116 | radius: CGFloat = 5) { 117 | self.color = color 118 | self.opacity = opacity 119 | self.offset = offset 120 | self.radius = radius 121 | } 122 | } 123 | 124 | /// The BottomSheetController grabber. 125 | public var grabber: Grabber? 126 | /// This is the corner radius used for the masked corners of the BottomSheetController view. 127 | public var cornerRadius: CGFloat 128 | /// These are the corners to apply the radius to. 129 | public var maskedCorners: CACornerMask 130 | /// This is the background color to use all around the BottomSheetController view. 131 | public var dimmingBackgroundColor: UIColor 132 | /// The BottomSheetController shadow. 133 | public var shadow: Shadow? 134 | /// Leading margin to apply to the bottom sheet in case we don't want it being attached to the left screen edge. 135 | public var leadingMargin: CGFloat 136 | /// Trailing margin to apply to the bottom sheet in case we don't want it being attached to the right screen edge. 137 | public var trailingMargin: CGFloat 138 | 139 | /// Initializes a new Theme. 140 | public init(grabber: BottomSheetController.Theme.Grabber? = Grabber(), 141 | cornerRadius: CGFloat = 12.0, 142 | maskedCorners: CACornerMask = .lbbsTop, 143 | dimmingBackgroundColor: UIColor = .lbbsDefaultDimmingBackgroundColor, 144 | shadow: BottomSheetController.Theme.Shadow? = Shadow(), 145 | leadingMargin: CGFloat = 0.0, 146 | trailingMargin: CGFloat = 0.0) { 147 | self.grabber = grabber 148 | self.cornerRadius = cornerRadius 149 | self.maskedCorners = maskedCorners 150 | self.dimmingBackgroundColor = dimmingBackgroundColor 151 | self.shadow = shadow 152 | self.leadingMargin = leadingMargin 153 | self.trailingMargin = trailingMargin 154 | } 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/UI/Common/Cells/SwiftSection/SwiftSectionCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/UI/BottomSheet.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /Sources/LBBottomSheet/LBBottomSheet.docc/Documentation.md: -------------------------------------------------------------------------------- 1 | # ``LBBottomSheet`` 2 | ![LBBottomSheet](PackageIcon) 3 | LBBottomSheet is a pure Swift component (iOS 11.4+) to easily present in a bottom sheet the controllers you want. 4 | With its smart and easy-to-use options, you can take advantage of this flexible and powerful package to fit your needs. 5 | 6 | ## Overview 7 | 8 | The BottomSheet gives you the ability to present a controller in a kind of "modal" for which you can choose the height you want. 9 | 10 | ## Installation 11 | 12 | To install using Swift Package Manager, in Xcode, go to File > Add Packages..., and use this URL to find the LBBottomSheet package: 13 | `https://github.com/LunabeeStudio/LBBottomSheet.git` 14 | 15 | After adding this Swift Package to your project, you have to import the module: 16 | ```swift 17 | import LBBottomSheet 18 | ``` 19 | 20 | ## Usage 21 | The BottomSheet gives you the ability to present a controller in a kind of "modal" for which you can choose the height you want. 22 | 23 | The are 3 differents ways of configuring the BottomSheet height represented by the enum. 24 | Here are the available height modes: 25 | | HeightMode | Description | 26 | | ------------ | ------------------------------------- | 27 | | `fitContent` | The bottom sheet will call `preferredHeightInBottomSheet` on the embedded controller to get the needed height. | 28 | | `free` | The bottom sheet height will be contained between `minHeight` and `maxHeight` and the bottom sheet will remain where the user releases it.| 29 | | `specific` | The bottom sheet will have multiple height values. When the user releases it, it will be attached to the nearest provided specific value. When presented, the bottom sheet will use the minimum value. It can be swipped up to the maximum value. You don't have to take care of the values order, the bottom sheet will sort them to find the matching one.| 30 | 31 | We'll see through the following examples, how you can configure it. 32 | 33 | ### FitContent - Example #1 34 | To show `MyViewController` in a bottom sheet above the current controller, you just need to call this from a view controller: 35 | ```swift 36 | let controller: MyViewController = .init() 37 | presentAsBottomSheet(controller) 38 | ``` 39 | A default and a default will be used. 40 | 41 | 42 | In this example, the grabber background is transparent. This way you see the tableView content behind the grabber when scrolling, which is the default configuration. Let's see in the next example how to configure this. 43 |
44 | ### FitContent - Example #2 45 | If you want, you can provide your own and configurations. 46 | For example, here we customize the grabber and the : 47 | ```swift 48 | let controller: MyViewController = .init() 49 | let grabberBackground: BottomSheetController.Theme.Grabber.Background = .color(.tableViewBackground.withAlphaComponent(0.9), isTranslucent: true) 50 | let grabber: BottomSheetController.Theme.Grabber = .init(background: grabberBackground) 51 | let theme: BottomSheetController.Theme = .init(grabber: grabber) 52 | let behavior: BottomSheetController.Behavior = .init(swipeMode: .full) 53 | presentAsBottomSheet(controller, theme: theme, behavior: behavior) 54 | ``` 55 | 56 | 57 | In this example, the background is translucent and we have a set to which means that the swipe down gesture will be detected from all the BottomSheet (this is the default behavior). 58 | 59 | 60 | ### FitContent - Example #3 61 | In this example, the grabber background is opaque and the swipeMode is set to .top which means that the swipe down gesture will only be detected from the grabber zone: 62 | ```swift 63 | let controller: MyViewController = .init() 64 | let grabberBackground: BottomSheetController.Theme.Grabber.Background = .color(.tableViewBackground, isTranslucent: false) 65 | let grabber: BottomSheetController.Theme.Grabber = .init(background: grabberBackground) 66 | let theme: BottomSheetController.Theme = .init(grabber: grabber) 67 | let behavior: BottomSheetController.Behavior = .init(swipeMode: .top) 68 | presentAsBottomSheet(controller, theme: theme, behavior: behavior) 69 | ``` 70 | 71 | 72 | ### FitContent - Example #4 73 | By default, the BottomSheet prevents you from interacting with the controller presenting it (like a standard modal). 74 | It is possible to configure this in the using this parameter: . 75 | This way you can continue to interact with the controller behind it. For a better experience, we advise you to set the `dimmingBackgroundColor` color to `.clear` and to implement the on the controller presenting your BottomSheet to dynamically adapt its bottom content inset if needed. 76 | Here is the BottomSheet configuration code: 77 | ```swift 78 | let controller: MyViewController = .init() 79 | let grabberBackground: BottomSheetController.Theme.Grabber.Background = .color(.tableViewBackground, isTranslucent: false) 80 | let grabber: BottomSheetController.Theme.Grabber = .init(background: grabberBackground) 81 | let theme: BottomSheetController.Theme = .init(grabber: grabber, dimmingBackgroundColor: .clear) 82 | let behavior: BottomSheetController.Behavior = .init(swipeMode: .full, forwardEventsToRearController: true) 83 | presentAsBottomSheet(controller, theme: theme, behavior: behavior) 84 | ``` 85 | 86 | 87 | Here is the implementation on the controller presenting the BottomSheet: 88 | ```swift 89 | extension MainViewController: BottomSheetPositionDelegate { 90 | func bottomSheetPositionDidUpdate(y: CGFloat) { 91 | tableView.contentInset.bottom = tableView.frame.height - y 92 | } 93 | } 94 | ``` 95 | 96 | This will prevent you from having content hidden by the BottomSheet in case you need to interact with it. 97 | 98 | 99 | ### FitContent - Advanced configuration 100 | In this mode, by default, the height is automatically calculated: 101 | - If the BottomSheet contains a UITableView/UICollectionView even if contained in a parent controller, it will use the contentInset top, bottom and the content size height to determine the needed height. 102 | - Otherwise, it will take the frame height of the embedded controller view. 103 | 104 | If you want to customize this calculation, you have to declare this variable on the controller you're embedding en the BottomSheet: 105 | ```swift 106 | @objc var preferredHeightInBottomSheet: CGFloat { /* Do your custom calculation here */ } 107 | ``` 108 | When this variable is declared, the BottomSheet will find and use it instead of the default calculation. 109 | 110 | If you present in a BottomSheet a controller for which the height can change while it is visible, you can tell the BottomSheet to update its height in order to keep a height matching the embbeded controller needs. This update is animated by the BottomSheet. 111 | To tell the BottomSheet to update its height, you just have to call this: 112 | ```swift 113 | bottomSheetController?.preferredHeightInBottomSheetDidUpdate() 114 | ``` 115 | 116 | `bottomSheetController` is available in any `UIViewController` as `navigationController` or `tabBarController` for example. 117 | 118 | The last thing for this mode is about the dynamic types. If you present in a BottomSheet, a controller using dynamic types to manage the font size changes based on the user's choices, the controller might need more height than the initial one if the font size changes while the controller is presented. 119 | You don't have to manage this as the BottomSheet is listening for the content size category changes notification. If the user changes the font size, the BottomSheet will automatically trigger a height update. 120 | 121 | 122 | 123 | ### Free height - Example #1 124 | Examples to come. 125 | 126 | 127 | 128 | ### Specific heights - Example #1 129 | Examples to come. 130 | 131 | 132 | 133 | ### Customization 134 | On the BottomSheet, it is possible to configure its appearance and its behavior. 135 | To do this you have 2 structs: and . 136 | Thanks to these structs, you can configure things like: 137 | - : having it or not, is color, size, corner radius, background color or view... 138 | - 139 | - 140 | - 141 | - Animations speed: and 142 | - (default provided value: ) 143 | - to dismiss 144 | - to dismiss 145 | - ... 146 | 147 | You can find all the available configuration parameters in this documentation. 148 | 149 | ## Repository 150 | 151 | You can find this Swift Package on this [GitHub repository](https://github.com/LunabeeStudio/LBBottomSheet) and on the [Swift Package Index](https://swiftpackageindex.com/LunabeeStudio/LBBottomSheet). 152 | 153 | ## Author 154 | 155 | The iOS team at [Lunabee Studio](https://www.lunabee.studio) 156 | 157 | ## License 158 | 159 | LBBottomSheet is available under the Apache 2.0 license. See the LICENSE file for more info. 160 | 161 | ## Topics 162 | 163 | ### Constants 164 | 165 | - ``BottomSheetConstant`` 166 | 167 | ### Controller 168 | 169 | - ``BottomSheetController`` 170 | 171 | ### Delegate 172 | 173 | - ``BottomSheetPositionDelegate`` 174 | - ``BottomSheetInteractionDelegate`` 175 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Modules/DemoTestCaseFactory.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2021 Lunabee Studio 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // DemoTestCaseFactory.swift 16 | // LBBottomSheet-Demo 17 | // 18 | // Created by Lunabee Studio / Date - 26/10/2021 - for the LBBottomSheet-Demo Swift Package. 19 | // 20 | 21 | import Foundation 22 | import LBBottomSheet 23 | 24 | final class DemoTestCaseFactory { 25 | static let fitContent: [DemoTestCase] = [ 26 | DemoTestCase(title: "FitContent", 27 | menuTitle: "Fit content - Example #1", 28 | explanations: """ 29 | Here you have an example of a \"small\" BottomSheet which is fitting the embedded controller height. 30 | 31 | 👉 This BottomSheet is using all the default values for the `Theme` and the `Behavior`. 32 | 33 | 👉 The grabber background is completly transparent so if you scroll this tableView, you'll see it directly under the grabber. 34 | """), 35 | DemoTestCase(title: "FitContent", 36 | menuTitle: "Fit content - Example #2", 37 | explanations: """ 38 | Here you have an example of a BottomSheet which is fitting the embedded controller height. 39 | 40 | 👉 The grabber background is translucent so if you scroll this tableView, you'll see it under the grabber background color. 41 | 42 | 👉 If you swipe up from the grabber zone, you'll directly see the elasticity effect. 43 | 44 | 👉 If you swipe down from the grabber zone the BottomSheet will be moved down. 45 | 46 | 👉 If you swipe down from this tableView, if the tableView is at its top, the BottomSheet will be moved down. 47 | Otherwise, the tableView will be scrolled. 48 | 49 | 👉 This swipe behavior is due to the `swipeMode` being set to `.full` in the `BottomSheetController.Behavior` configuration struct. 50 | This is the default behavior. 51 | You can have a look at the documentation to check the possible values. 52 | """, 53 | codeUrl: URL(string: "https://github.com/LunabeeStudio/LBBottomSheet/blob/4c4273fbd9a2a44ca7802d3149b2f68e88f8f725/LBBottomSheet-Demo/LBBottomSheet-Demo/Modules/DemoTestCaseFactory.swift#L55"), 54 | theme: { 55 | let grabberBackground: BottomSheetController.Theme.Grabber.Background = .color(.tableViewBackground.withAlphaComponent(0.9), isTranslucent: true) 56 | let grabber: BottomSheetController.Theme.Grabber = .init(background: grabberBackground) 57 | return BottomSheetController.Theme(grabber: grabber) 58 | }), 59 | DemoTestCase(title: "FitContent", 60 | menuTitle: "Fit content - Example #3", 61 | explanations: """ 62 | Here you have an example of a BottomSheet which is fitting the embedded controller height. 63 | 64 | 👉 The grabber background is completly opaque so if you scroll this tableView, you'll not see it under the grabber. 65 | 66 | 👉 The grabber background can be configured in the `BottomSheetController.Theme.Grabber` configuration struct. 67 | The default behavior is to have a grabber with no background. 68 | You can have a look at the documentation to check the possible values. 69 | 70 | 👉 This BottomSheet has a `swipeMode` set to `.top`. It means that the dismiss swipe down gesture is only working when you start it from the grabber zone. 71 | """, 72 | codeUrl: URL(string: "https://github.com/LunabeeStudio/LBBottomSheet/blob/4c4273fbd9a2a44ca7802d3149b2f68e88f8f725/LBBottomSheet-Demo/LBBottomSheet-Demo/Modules/DemoTestCaseFactory.swift#L74"), 73 | theme: { 74 | let grabberBackground: BottomSheetController.Theme.Grabber.Background = .color(.tableViewBackground, isTranslucent: false) 75 | let grabber: BottomSheetController.Theme.Grabber = .init(background: grabberBackground) 76 | return BottomSheetController.Theme(grabber: grabber) 77 | }, behavior: { 78 | BottomSheetController.Behavior(swipeMode: .top) 79 | }), 80 | DemoTestCase(title: "FitContent", 81 | menuTitle: "Fit content - Example #4", 82 | explanations: """ 83 | Here you have an example of a BottomSheet which is fitting the embedded controller height. 84 | 85 | 👉 In addition to others, you can still interact with the controller behind it. 86 | 87 | 👉 You can also see that the tableView behind the BottomSheet has its bottom inset updated to not have its content hidden by the BottomSheet. 88 | To do this, you just have to implement the `BottomSheetPositionDelegate` on the controller needing a bottom inset update, and to give this controller to the `presentAsBottomSheet` method. 89 | """, 90 | codeUrl: URL(string: "https://github.com/LunabeeStudio/LBBottomSheet/blob/4c4273fbd9a2a44ca7802d3149b2f68e88f8f725/LBBottomSheet-Demo/LBBottomSheet-Demo/Modules/DemoTestCaseFactory.swift#L92"), 91 | theme: { 92 | let grabberBackground: BottomSheetController.Theme.Grabber.Background = .color(.tableViewBackground, isTranslucent: false) 93 | let grabber: BottomSheetController.Theme.Grabber = .init(background: grabberBackground) 94 | return BottomSheetController.Theme(grabber: grabber, dimmingBackgroundColor: .clear) 95 | }, behavior: { 96 | BottomSheetController.Behavior(forwardEventsToRearController: true) 97 | }) 98 | ] 99 | 100 | static let free: [DemoTestCase] = [ 101 | DemoTestCase(title: "Free", 102 | menuTitle: "Free - Example #1", 103 | explanations: """ 104 | Here you have an example of a BottomSheet with a height being between 300pts and 600pts of the screen height. 105 | 106 | 👉 If you release the BottomSheet at any point between the min and max height, it will remains there. 107 | """, 108 | codeUrl: URL(string: "https://github.com/LunabeeStudio/LBBottomSheet/blob/4c4273fbd9a2a44ca7802d3149b2f68e88f8f725/LBBottomSheet-Demo/LBBottomSheet-Demo/Modules/DemoTestCaseFactory.swift#L112"), 109 | theme: { 110 | let grabberBackground: BottomSheetController.Theme.Grabber.Background = .color(.tableViewBackground, isTranslucent: false) 111 | let grabber: BottomSheetController.Theme.Grabber = .init(background: grabberBackground) 112 | return BottomSheetController.Theme(grabber: grabber) 113 | }, behavior: { 114 | BottomSheetController.Behavior(heightMode: .free(minHeight: 300.0, maxHeight: 600.0)) 115 | }) 116 | ] 117 | 118 | static let specific: [DemoTestCase] = [ 119 | DemoTestCase(title: "Specific", 120 | menuTitle: "Specific - Example #1", 121 | explanations: """ 122 | Here you have an example of a BottomSheet with specific heights. 123 | This allows you to define multiple positions for your BottomSheet. 124 | 125 | 👉 This bottom sheet has different height values: 200.0pts, 50%, 75% and 100% of the screen height. 126 | When the user releases the bottom sheet, its height will be updated to the predefined nearest one. 127 | 128 | 👉 The height limit is defined to `.screen` to allow the bottom sheet to cover the full screen height. 129 | """, 130 | codeUrl: URL(string: "https://github.com/LunabeeStudio/LBBottomSheet/blob/4c4273fbd9a2a44ca7802d3149b2f68e88f8f725/LBBottomSheet-Demo/LBBottomSheet-Demo/Modules/DemoTestCaseFactory.swift#L133"), 131 | theme: { 132 | let grabberBackground: BottomSheetController.Theme.Grabber.Background = .color(.tableViewBackground, isTranslucent: false) 133 | let grabber: BottomSheetController.Theme.Grabber = .init(background: grabberBackground) 134 | return BottomSheetController.Theme(grabber: grabber) 135 | }, behavior: { 136 | BottomSheetController.Behavior(heightMode: .specific(values: [ 137 | .fixed(value: 200.0), 138 | .screenRatio(value: 0.5), 139 | .screenRatio(value: 0.75), 140 | .screenRatio(value: 1.0) 141 | ], heightLimit: .screen)) 142 | }), 143 | DemoTestCase(title: "Specific", 144 | menuTitle: "Specific - Example #2", 145 | explanations: """ 146 | Here you have an example of a BottomSheet which is fullscreen. 147 | 148 | 👉 This bottom sheet has only one height value: `.screenRatio(1.0)`. 149 | 150 | 👉 The height limit is defined to `.screen` to allow the bottom sheet to cover the full screen height. 151 | """, 152 | codeUrl: URL(string: "https://github.com/LunabeeStudio/LBBottomSheet/blob/a53726b499cc0d2e2f53f5fc50b7507e7a8f68e8/LBBottomSheet-Demo/LBBottomSheet-Demo/Modules/DemoTestCaseFactory.swift#L154"), 153 | theme: { 154 | let grabberBackground: BottomSheetController.Theme.Grabber.Background = .color(.tableViewBackground, isTranslucent: false) 155 | let grabber: BottomSheetController.Theme.Grabber = .init(background: grabberBackground) 156 | return BottomSheetController.Theme(grabber: grabber) 157 | }, behavior: { 158 | BottomSheetController.Behavior(heightMode: .specific(values: [.screenRatio(value: 1.0)], heightLimit: .screen)) 159 | }) 160 | ] 161 | } 162 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/UI/Common/Cells/InvertedCard/InvertedCardCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /LBBottomSheet-Demo/LBBottomSheet-Demo/Application/UI/Common/Cells/Card/CardCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 36 | 37 | 38 | 39 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | --------------------------------------------------------------------------------