Skip to content

Commit

Permalink
major version: 1.0.0; example improved, readme updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
OfTheWolf committed Apr 27, 2020
1 parent b2053ce commit 9500e36
Show file tree
Hide file tree
Showing 15 changed files with 501 additions and 136 deletions.
4 changes: 2 additions & 2 deletions DefaultSheetAnimator.swift
Expand Up @@ -8,8 +8,8 @@

import UIKit

class DefaultSheetAnimator: Animatable {
func animate(animations: @escaping () -> Void, completion: ((Bool) -> Void)?){
public class DefaultSheetAnimator: Animatable {
public func animate(animations: @escaping () -> Void, completion: ((Bool) -> Void)?){
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.8, options: [.curveEaseInOut, .allowUserInteraction], animations: animations, completion: completion)
}
}
16 changes: 16 additions & 0 deletions Example/UBottomSheet.xcodeproj/project.pbxproj
Expand Up @@ -14,6 +14,10 @@
0CC171452334257C002A02FD /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CC171422334257C002A02FD /* ViewController.swift */; };
0CC1714723342585002A02FD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0CC1714623342585002A02FD /* Main.storyboard */; };
0CC17149233425AB002A02FD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0CC17148233425AA002A02FD /* Images.xcassets */; };
0CDF2F67245638B100AAE66E /* SimpleCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CDF2F66245638B100AAE66E /* SimpleCollectionCell.swift */; };
0CDF2F69245638C700AAE66E /* EmbeddedCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CDF2F68245638C700AAE66E /* EmbeddedCell.swift */; };
0CDF2F6C245647ED00AAE66E /* LabelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CDF2F6A245647ED00AAE66E /* LabelViewController.swift */; };
0CDF2F6D245647ED00AAE66E /* LabelViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0CDF2F6B245647ED00AAE66E /* LabelViewController.xib */; };
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
Expand All @@ -37,6 +41,10 @@
0CC171422334257C002A02FD /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
0CC1714623342585002A02FD /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
0CC17148233425AA002A02FD /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
0CDF2F66245638B100AAE66E /* SimpleCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleCollectionCell.swift; sourceTree = "<group>"; };
0CDF2F68245638C700AAE66E /* EmbeddedCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmbeddedCell.swift; sourceTree = "<group>"; };
0CDF2F6A245647ED00AAE66E /* LabelViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelViewController.swift; sourceTree = "<group>"; };
0CDF2F6B245647ED00AAE66E /* LabelViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LabelViewController.xib; sourceTree = "<group>"; };
4E980B1CC97C3CFCFF0A9FB0 /* Pods-UBottomSheet_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UBottomSheet_Example.release.xcconfig"; path = "Target Support Files/Pods-UBottomSheet_Example/Pods-UBottomSheet_Example.release.xcconfig"; sourceTree = "<group>"; };
5D316F3B7AE3074480477D40 /* UBottomSheet.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = UBottomSheet.podspec; path = ../UBottomSheet.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
607FACD01AFB9204008FA782 /* UBottomSheet_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UBottomSheet_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -103,9 +111,13 @@
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
0CC171422334257C002A02FD /* ViewController.swift */,
0CC171412334257C002A02FD /* SimpleTableCell.swift */,
0CDF2F68245638C700AAE66E /* EmbeddedCell.swift */,
0CDF2F66245638B100AAE66E /* SimpleCollectionCell.swift */,
0CA1808B245377CF00C6CBDE /* MapsDemoBottomSheetController.swift */,
0CC17148233425AA002A02FD /* Images.xcassets */,
0CC1714623342585002A02FD /* Main.storyboard */,
0CDF2F6A245647ED00AAE66E /* LabelViewController.swift */,
0CDF2F6B245647ED00AAE66E /* LabelViewController.xib */,
607FACDE1AFB9204008FA782 /* LaunchScreen.xib */,
607FACD31AFB9204008FA782 /* Supporting Files */,
);
Expand Down Expand Up @@ -260,6 +272,7 @@
0CC17149233425AB002A02FD /* Images.xcassets in Resources */,
0CC1714723342585002A02FD /* Main.storyboard in Resources */,
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */,
0CDF2F6D245647ED00AAE66E /* LabelViewController.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -346,6 +359,9 @@
0CC171452334257C002A02FD /* ViewController.swift in Sources */,
0CA1808C245377CF00C6CBDE /* MapsDemoBottomSheetController.swift in Sources */,
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
0CDF2F6C245647ED00AAE66E /* LabelViewController.swift in Sources */,
0CDF2F67245638B100AAE66E /* SimpleCollectionCell.swift in Sources */,
0CDF2F69245638C700AAE66E /* EmbeddedCell.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
51 changes: 51 additions & 0 deletions Example/UBottomSheet/EmbeddedCell.swift
@@ -0,0 +1,51 @@
//
// EmbeddedCell.swift
// UBottomSheet_Example
//
// Created by ugur on 27.04.2020.
// Copyright © 2020 CocoaPods. All rights reserved.
//

import UIKit

class EmbeddedCell: UITableViewCell, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
@IBOutlet weak var collectionView: UICollectionView!

var items: [CollectionModel] = []

override func awakeFromNib() {
super.awakeFromNib()
// Initialization code

collectionView.contentInset = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 0)
collectionView.dataSource = self
collectionView.delegate = self
collectionView.alwaysBounceHorizontal = true
collectionView.showsHorizontalScrollIndicator = false

if #available(iOS 13.0, *) {
items.append(CollectionModel(image: UIImage(systemName: "house.fill"), title: "Home"))
items.append(CollectionModel(image: UIImage(systemName: "briefcase.fill"), title: "Work"))
items.append(CollectionModel(image: UIImage(systemName: "plus"), title: "Add"))
} else {
items.append(CollectionModel(image: #imageLiteral(resourceName: "heart_icon"), title: "Home"))
items.append(CollectionModel(image: #imageLiteral(resourceName: "heart_icon"), title: "Work"))
items.append(CollectionModel(image: #imageLiteral(resourceName: "heart_icon"), title: "Add"))
}
}

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: collectionView.frame.width/5, height: collectionView.frame.height)
}

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return items.count
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "SimpleCollectionCell", for: indexPath) as! SimpleCollectionCell
cell.configure(with: items[indexPath.item])
return cell
}

}
27 changes: 27 additions & 0 deletions Example/UBottomSheet/LabelViewController.swift
@@ -0,0 +1,27 @@
//
// LabelViewController.swift
// UBottomSheet_Example
//
// Created by ugur on 27.04.2020.
// Copyright © 2020 CocoaPods. All rights reserved.
//

import UIKit
import UBottomSheet

class LabelViewController: UIViewController, Draggable {
var sheetCoordinator: UBottomSheetCoordinator?

override func viewDidLoad() {
super.viewDidLoad()

sheetCoordinator?.startTracking(item: self)

// Do any additional setup after loading the view.
}

@IBAction func dismissAction(){
sheetCoordinator?.removeSheetChild(item: self)
}

}
54 changes: 54 additions & 0 deletions Example/UBottomSheet/LabelViewController.xib
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="LabelViewController" customModule="UBottomSheet_Example" customModuleProvider="target">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yyc-yZ-Ncs">
<rect key="frame" x="20" y="94" width="374" height="30"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="25"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MU4-6n-lj5">
<rect key="frame" x="341" y="44" width="73" height="72"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<inset key="contentEdgeInsets" minX="20" minY="20" maxX="20" maxY="20"/>
<state key="normal" image="xmark.circle.fill" catalog="system">
<preferredSymbolConfiguration key="preferredSymbolConfiguration" configurationType="pointSize" pointSize="21" scale="large" weight="black"/>
</state>
<connections>
<action selector="dismissAction" destination="-1" eventType="touchUpInside" id="kja-Lm-Q8G"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.0" green="0.40000000000000002" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="yyc-yZ-Ncs" secondAttribute="trailing" constant="20" id="HA6-11-WRR"/>
<constraint firstItem="yyc-yZ-Ncs" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="50" id="WHl-cy-Cg1"/>
<constraint firstItem="yyc-yZ-Ncs" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="20" id="abQ-pj-GOi"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="MU4-6n-lj5" secondAttribute="trailing" id="ixT-Z6-cFi"/>
<constraint firstItem="MU4-6n-lj5" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="sI9-pF-UAK"/>
</constraints>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="139" y="100"/>
</view>
</objects>
<resources>
<image name="xmark.circle.fill" catalog="system" width="64" height="60"/>
</resources>
</document>

0 comments on commit 9500e36

Please sign in to comment.