Unverified Commit a4da6ae6 authored by Zach Knox's avatar Zach Knox
Browse files

updated cocoapods in hopes of fixing search bug

I didn't
parent 6b085653
PODS:
- DeckTransition (1.4.0)
- ObjectMapper (3.0.0)
- Realm (2.10.1):
- Realm/Headers (= 2.10.1)
- Realm/Headers (2.10.1)
- RealmSwift (2.10.1):
- Realm (= 2.10.1)
- DeckTransition (1.4.2)
- ObjectMapper (3.1.0)
- Realm (3.0.2):
- Realm/Headers (= 3.0.2)
- Realm/Headers (3.0.2)
- RealmSwift (3.0.2):
- Realm (= 3.0.2)
DEPENDENCIES:
- DeckTransition (~> 1.4.0)
......@@ -13,10 +13,10 @@ DEPENDENCIES:
- RealmSwift
SPEC CHECKSUMS:
DeckTransition: d678005a9b35c2745fe8b683c39c41f840ad69d7
ObjectMapper: 92230db59bf8f341a5c3a3cf0b9fbdde3cf0d87f
Realm: fc7a317a5c2c9ba91f5f235ede4e2ea76e9eba0c
RealmSwift: 505ed6c15942a2e76f5cfa78a8667cfa997ee75b
DeckTransition: 56330226ddbefd2ddc9f57b8b56d37e0e93e6b91
ObjectMapper: 20505058f54e5c3ca69e1d6de9897d152a5369a6
Realm: 6f23fd1f178a09342eac21bfa7c2bf4312a7a180
RealmSwift: 695393add1b8f9d5fa75dd16e6355cf3935f71e2
PODFILE CHECKSUM: 5595b2ebe2214e0d557d3eac7bdc9dbb3b2edf20
......
......@@ -2,16 +2,16 @@
[![CI Status](http://img.shields.io/travis/HarshilShah/DeckTransition.svg)](https://travis-ci.org/HarshilShah/DeckTransition)
[![Version](https://img.shields.io/github/release/HarshilShah/DeckTransition.svg)](https://github.com/HarshilShah/DeckTransition/releases/latest)
[![CocoaPods](https://img.shields.io/badge/CocoaPods-compatible-fb0006.svg)](http://cocoapods.org/pods/DeckTransition)
[![Carthage](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage)
[![License](https://img.shields.io/cocoapods/l/DeckTransition.svg)](https://github.com/HarshilShah/DeckTransition/blob/master/LICENSE)
![Package Managers](https://img.shields.io/badge/supports-CocoaPods%20%7C%20Carthage-orange.svg)
[![Documentation](https://cdn.rawgit.com/HarshilShah/DeckTransition/master/docs/badge.svg)](https://harshilshah.github.com/DeckTransition)
[![License](https://img.shields.io/badge/license-MIT-999999.svg)](https://github.com/HarshilShah/DeckTransition/blob/master/LICENSE)
[![Contact](https://img.shields.io/badge/contact-%40HarshilShah1910-3a8fc1.svg)](https://twitter.com/HarshilShah1910)
DeckTransition is an attempt to recreate the card-like transition found in the iOS 10 Apple Music and iMessage apps.
Hereʼs a GIF showing it in action.
![Demo](demo.gif)
![Demo](https://raw.githubusercontent.com/HarshilShah/DeckTransition/master/Resources/demo.gif)
## Requirements
......@@ -36,6 +36,10 @@ To install DeckTransition using [Carthage](https://github.com/Carthage/Carthage)
github "HarshilShah/DeckTransition" ~> 1.0
```
## Documentation
You can find [the docs here](https://harshilshah.github.io/DeckTransition "Documentation"). Documentation is generated with [Jazzy](https://github.com/realm/jazzy), and hosted on [GitHub Pages](https://pages.github.com).
## Usage
### Basics
......@@ -131,6 +135,7 @@ It's worth noting that updating the snapshot is an expensive process and should
## Apps Using DeckTransition
- [Petty](https://zachsim.one/projects/petty) by [Zach Simone](https://twitter.com/zachsimone)
- [Bitbook](https://bitbookapp.com) by [Sammy Gutierrez](https://sammygutierrez.com)
- [BookPlayer](https://github.com/GianniCarlo/Audiobook-Player) by [Gianni Carlo](https://twitter.com/GCarlo89)
Feel free to submit a PR if you’re using this library in your apps
......
......@@ -9,19 +9,19 @@
import UIKit
final class DeckDismissingAnimationController: NSObject, UIViewControllerAnimatedTransitioning {
// MARK:- Private variables
private let duration: TimeInterval?
// MARK:- Initializers
init(duration: TimeInterval?) {
self.duration = duration
}
// MARK:- UIViewControllerAnimatedTransitioning
// MARK: - Private variables
private let duration: TimeInterval?
// MARK: - Initializers
init(duration: TimeInterval?) {
self.duration = duration
}
// MARK: - UIViewControllerAnimatedTransitioning
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
/// The presentedViewController throughout this library refers to the
......@@ -53,5 +53,6 @@ final class DeckDismissingAnimationController: NSObject, UIViewControllerAnimate
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return duration ?? Constants.defaultAnimationDuration
}
}
......@@ -9,18 +9,18 @@
import UIKit
final class DeckPresentingAnimationController: NSObject, UIViewControllerAnimatedTransitioning {
// MARK:- Private variables
private let duration: TimeInterval?
// MARK:- Initializers
init(duration: TimeInterval?) {
self.duration = duration
}
// MARK:- UIViewControllerAnimatedTransitioning
// MARK: - Private variables
private let duration: TimeInterval?
// MARK: - Initializers
init(duration: TimeInterval?) {
self.duration = duration
}
// MARK: - UIViewControllerAnimatedTransitioning
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let presentedViewController = transitionContext.viewController(forKey: .to) else {
......@@ -41,8 +41,7 @@ final class DeckPresentingAnimationController: NSObject, UIViewControllerAnimate
presentedViewController.view.frame = finalFrameForPresentedView
}, completion: { finished in
transitionContext.completeTransition(finished)
}
)
})
}
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
......@@ -50,3 +49,4 @@ final class DeckPresentingAnimationController: NSObject, UIViewControllerAnimate
}
}
......@@ -8,11 +8,15 @@
import UIKit
/// A segue to implement the deck transition via Storyboards
/// A segue to implement the Deck transition via Storyboards
///
/// To use this, set your segue's class to `DeckSegue`, and its `kind` to
/// `custom`
public final class DeckSegue: UIStoryboardSegue {
var transition: UIViewControllerTransitioningDelegate!
/// Performs the visual transition for the Deck segue.
public override func perform() {
transition = DeckTransitioningDelegate()
destination.transitioningDelegate = transition
......
......@@ -8,82 +8,124 @@
import UIKit
/// The DeckTransitioningDelegate class vends out the presentation and animation
/// controllers required to present a view controller with the Deck transition
/// style
///
/// The following snippet described the steps for presenting a given
/// `ModalViewController` with the `DeckTransitioningDelegate`
///
/// ```swift
/// let modal = ModalViewController()
/// let transitionDelegate = DeckTransitioningDelegate()
/// modal.transitioningDelegate = transitionDelegate
/// modal.modalPresentationStyle = .custom
/// present(modal, animated: true, completion: nil)
/// ```
public final class DeckTransitioningDelegate: NSObject, UIViewControllerTransitioningDelegate, DeckPresentationControllerDelegate {
// MARK:- Public variables
/// A variable indicating whether or not the presenting view controller
/// can currently be dismissed using a pan gestures from top to bottom.
///
/// When set to `true`, this allows the presented modal view to be dismissed
/// using a pan gesture. The default value of this property is `true`
public var isDismissEnabled = true
// MARK:- Private variables
private let presentDuration: TimeInterval?
private let presentAnimation: (() -> ())?
private let presentCompletion: ((Bool) -> ())?
private let dismissDuration: TimeInterval?
private let dismissAnimation: (() -> ())?
private let dismissCompletion: ((Bool) -> ())?
// MARK:- Initializers
/// Returns a transitioning delegate to perform a card transition. All
/// parameters are optional. Leaving the duration parameters empty gives you
/// animations with the default durations (0.3s for both)
///
/// - Parameters:
/// - presentDuration: The duration for the presentation animation
/// - presentAnimation: An animation block that will be performed
/// alongside the card presentation animation
/// - presentCompletion: A block that will be run after the card has been
/// presented
/// - dismissDuration: The duration for the dismissal animation
/// - dismissAnimation: An animation block that will be performed
/// alongside the card dismissal animation
/// - dismissCompletion: A block that will be run after the card has been
/// dismissed
@objc public init(presentDuration: NSNumber? = nil,
presentAnimation: (() -> ())? = nil,
presentCompletion: ((Bool) -> ())? = nil,
dismissDuration: NSNumber? = nil,
dismissAnimation: (() -> ())? = nil,
dismissCompletion: ((Bool) -> ())? = nil) {
self.presentDuration = presentDuration?.doubleValue
self.presentAnimation = presentAnimation
self.presentCompletion = presentCompletion
self.dismissDuration = dismissDuration?.doubleValue
self.dismissAnimation = dismissAnimation
self.dismissCompletion = dismissCompletion
}
// MARK:- UIViewControllerTransitioningDelegate
// MARK: - Public variables
/// A variable indicating whether or not the presenting view controller
/// can currently be dismissed using a pan gestures from top to bottom.
///
/// When set to `true`, this allows the presented modal view to be dismissed
/// using a pan gesture. The default value of this property is `true`
public var isDismissEnabled = true
// MARK: - Private variables
private let presentDuration: TimeInterval?
private let presentAnimation: (() -> ())?
private let presentCompletion: ((Bool) -> ())?
private let dismissDuration: TimeInterval?
private let dismissAnimation: (() -> ())?
private let dismissCompletion: ((Bool) -> ())?
// MARK: - Initializers
/// Returns a transitioning delegate to perform a Deck transition. All
/// parameters are optional. Leaving the duration parameters empty gives you
/// animations with the default durations (0.3s for both)
///
/// - Parameters:
/// - presentDuration: The duration for the presentation animation
/// - presentAnimation: An animation block that will be performed
/// alongside the card presentation animation
/// - presentCompletion: A block that will be run after the card has been
/// presented
/// - dismissDuration: The duration for the dismissal animation
/// - dismissAnimation: An animation block that will be performed
/// alongside the card dismissal animation
/// - dismissCompletion: A block that will be run after the card has been
/// dismissed
@objc public init(presentDuration: NSNumber? = nil,
presentAnimation: (() -> ())? = nil,
presentCompletion: ((Bool) -> ())? = nil,
dismissDuration: NSNumber? = nil,
dismissAnimation: (() -> ())? = nil,
dismissCompletion: ((Bool) -> ())? = nil) {
self.presentDuration = presentDuration?.doubleValue
self.presentAnimation = presentAnimation
self.presentCompletion = presentCompletion
self.dismissDuration = dismissDuration?.doubleValue
self.dismissAnimation = dismissAnimation
self.dismissCompletion = dismissCompletion
}
// MARK: - UIViewControllerTransitioningDelegate
/// Returns an animation controller that animates the modal presentation
///
/// This is internal infrastructure handled entirely by UIKit and shouldn't
/// be called directly
///
/// - Parameters:
/// - presented: The modal view controller to be presented onscreen
/// - presenting: The view controller that will be presenting the modal
/// - source: The view controller whose `present` method is called
/// - Returns: An animation controller that animates the modal presentation
public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return DeckPresentingAnimationController(duration: presentDuration)
}
/// Returns an animation controller that animates the modal dismissal
///
/// This is internal infrastructure handled entirely by UIKit and shouldn't
/// be called directly
///
/// - Parameter dismissed: The modal view controller which will be dismissed
/// - Returns: An animation controller that animates the modal dismisall
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return DeckDismissingAnimationController(duration: dismissDuration)
}
/// Returns a presentation controller that manages the modal presentation
///
/// This is internal infrastructure handled entirely by UIKit and shouldn't
/// be called directly
///
/// - Parameters:
/// - presented: The modal view controller
/// - presenting: The view controller which presented the modal
/// - source: The view controller whose `present` method was called to
/// present the modal
/// - Returns: A presentation controller that manages the modal presentation
public func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
let presentationController = DeckPresentationController(
presentedViewController: presented,
presenting: presenting,
presentAnimation: presentAnimation,
presentCompletion: presentCompletion,
dismissAnimation: dismissAnimation,
dismissCompletion: dismissCompletion)
presentedViewController: presented,
presenting: presenting,
presentAnimation: presentAnimation,
presentCompletion: presentCompletion,
dismissAnimation: dismissAnimation,
dismissCompletion: dismissCompletion)
presentationController.transitioningDelegate = self
return presentationController
}
// MARK: - DeckPresentationControllerDelegate methods
internal func isDismissGestureEnabled() -> Bool {
func isDismissGestureEnabled() -> Bool {
return isDismissEnabled
}
......
......@@ -47,7 +47,6 @@ extension CGRect {
return getCorner(.bottomRight)
}
}
......
......@@ -10,7 +10,7 @@ import UIKit
final class CornerView: UIView {
// MARK:- Public variables
// MARK: - Public variables
var cornerRadius: CGFloat {
get { return cornerLayer.radius }
......@@ -22,19 +22,19 @@ final class CornerView: UIView {
set { cornerLayer.corner = newValue }
}
// MARK:- Private variables
// MARK: - Private variables
private var cornerLayer: CornerLayer {
return layer as! CornerLayer
}
// MARK:- Layer override
// MARK: - Layer override
override class var layerClass: AnyClass {
return CornerLayer.self
}
// MARK:- Initializers
// MARK: - Initializers
override init(frame: CGRect) {
super.init(frame: frame)
......@@ -59,7 +59,7 @@ final class CornerView: UIView {
private final class CornerLayer: CAShapeLayer {
// MARK:- Public variables
// MARK: - Public variables
override var frame: CGRect {
didSet { setNeedsDisplay() }
......@@ -71,11 +71,11 @@ private final class CornerLayer: CAShapeLayer {
didSet { setNeedsDisplay() }
}
// MARK:- Private variables
// MARK: - Private variables
private static let radiusKey = "radius"
// MARK:- Animation overrides
// MARK: - Animation overrides
override static func needsDisplay(forKey key: String) -> Bool {
guard key == radiusKey else {
......@@ -112,13 +112,13 @@ private final class CornerLayer: CAShapeLayer {
return animation
}
// MARK:- CALayer methods
// MARK: - CALayer methods
override func display() {
self.path = currentPath()
}
// MARK:- Private methods
// MARK: - Private methods
private func currentPath() -> CGPath? {
guard let corner = corner else {
......
......@@ -10,7 +10,7 @@ import UIKit
final class RoundedView: UIView {
// MARK:- Public variables
// MARK: - Public variables
public var cornerRadius = Constants.cornerRadius {
didSet {
......@@ -19,12 +19,12 @@ final class RoundedView: UIView {
}
}
// MARK:- Private variables
// MARK: - Private variables
private let leftCorner = CornerView()
private let rightCorner = CornerView()
// MARK:- Initializers
// MARK: - Initializers
override init(frame: CGRect) {
super.init(frame: frame)
......@@ -55,7 +55,7 @@ final class RoundedView: UIView {
addSubview(rightCorner)
}
// MARK:- UIView methods
// MARK: - UIView methods
override func layoutSubviews() {
super.layoutSubviews()
......
PODS:
- DeckTransition (1.4.0)
- ObjectMapper (3.0.0)
- Realm (2.10.1):
- Realm/Headers (= 2.10.1)
- Realm/Headers (2.10.1)
- RealmSwift (2.10.1):
- Realm (= 2.10.1)
- DeckTransition (1.4.2)
- ObjectMapper (3.1.0)
- Realm (3.0.2):
- Realm/Headers (= 3.0.2)
- Realm/Headers (3.0.2)
- RealmSwift (3.0.2):
- Realm (= 3.0.2)
DEPENDENCIES:
- DeckTransition (~> 1.4.0)
......@@ -13,10 +13,10 @@ DEPENDENCIES:
- RealmSwift
SPEC CHECKSUMS:
DeckTransition: d678005a9b35c2745fe8b683c39c41f840ad69d7
ObjectMapper: 92230db59bf8f341a5c3a3cf0b9fbdde3cf0d87f
Realm: fc7a317a5c2c9ba91f5f235ede4e2ea76e9eba0c
RealmSwift: 505ed6c15942a2e76f5cfa78a8667cfa997ee75b
DeckTransition: 56330226ddbefd2ddc9f57b8b56d37e0e93e6b91
ObjectMapper: 20505058f54e5c3ca69e1d6de9897d152a5369a6
Realm: 6f23fd1f178a09342eac21bfa7c2bf4312a7a180
RealmSwift: 695393add1b8f9d5fa75dd16e6355cf3935f71e2
PODFILE CHECKSUM: 5595b2ebe2214e0d557d3eac7bdc9dbb3b2edf20
......
......@@ -35,7 +35,7 @@ open class HexColorTransform: TransformType {
open func transformFromJSON(_ value: Any?) -> Object? {
if let rgba = value as? String {
if rgba.hasPrefix("#") {
let index = rgba.characters.index(rgba.startIndex, offsetBy: 1)
let index = rgba.index(rgba.startIndex, offsetBy: 1)
let hex = String(rgba[index...])
return getColor(hex: hex)
} else {
......@@ -89,7 +89,7 @@ open class HexColorTransform: TransformType {
let scanner = Scanner(string: hex)
var hexValue: CUnsignedLongLong = 0
if scanner.scanHexInt64(&hexValue) {
switch (hex.characters.count) {
switch (hex.count) {
case 3:
red = CGFloat((hexValue & 0xF00) >> 8) / 15.0
green = CGFloat((hexValue & 0x0F0) >> 4) / 15.0
......
......@@ -280,6 +280,44 @@ public final class Mapper<N: BaseMappable> {
}
}
extension Mapper {
// MARK: Functions that create model from JSON file
/// JSON file to Mappable object
/// - parameter JSONfile: Filename
/// - Returns: Mappable object
public func map(JSONfile: String) -> N? {
if let path = Bundle.main.path(forResource: JSONfile, ofType: nil) {
do {
let JSONString = try String(contentsOfFile: path)
do {
return self.map(JSONString: JSONString)
}
} catch {
return nil
}
}
return nil
}
/// JSON file to Mappable object array
/// - parameter JSONfile: Filename
/// - Returns: Mappable object array
public func mapArray(JSONfile: String) -> [N]? {
if let path = Bundle.main.path(forResource: JSONfile, ofType: nil) {
do {
let JSONString = try String(contentsOfFile: path)
do {
return self.mapArray(JSONString: JSONString)
}
} catch {
return nil
}
}
return nil
}
}
extension Mapper {
// MARK: Functions that create JSON from objects
......
......@@ -34,14 +34,14 @@ private func setValue(_ value: Any, map: Map) {
private func setValue(_ value: Any, key: String, checkForNestedKeys: Bool, delimiter: String, dictionary: inout [String : Any]) {
if checkForNestedKeys {
let keyComponents = ArraySlice(key.components(separatedBy: delimiter).filter { !$0.isEmpty }.map { $0.characters })
let keyComponents = ArraySlice(key.components(separatedBy: delimiter).filter { !$0.isEmpty }.map { $0 })
setValue(value, forKeyPathComponents: keyComponents, dictionary: &dictionary)
} else {
dictionary[key] = value
}
}
private func setValue(_ value: Any, forKeyPathComponents components: ArraySlice<String.CharacterView.SubSequence>, dictionary: inout [String : Any]) {
private func setValue(_ value: Any, forKeyPathComponents components: ArraySlice<String>, dictionary: inout [String : Any]) {
if components.isEmpty {
return
}
......
......@@ -40,7 +40,7 @@ open class URLTransform: TransformType {
to `NSURL(string:)`
- returns: an initialized transformer
*/