Skip to content

Commit

Permalink
Add event listeners to SwiftMessagesSegue
Browse files Browse the repository at this point in the history
  • Loading branch information
wtmoose committed Dec 26, 2018
1 parent f8d4d4b commit b7dfd57
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 45 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Change Log
All notable changes to this project will be documented in this file.

## 6.0.2

### Features

* #262 Add event listeners to `SwiftMessagesSegue`.

## 6.0.1

### Features
Expand Down
38 changes: 14 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,6 @@
[![Platform](https://img.shields.io/cocoapods/p/SwiftMessages.svg?style=flat)](http://cocoadocs.org/docsets/SwiftMessages)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

## 🔥 SwiftAutoLayout 🔥

Check out our new repo, [SwiftAutoLayout](https://github.com/SwiftKickMobile/SwiftAutoLayout)!

SwiftAutoLayout helps you write AutoLayout constraints as consisely, Swiftly, and as natively as possible. Constrain `UIView` and `UILayoutGuide`s interchangeably with a familiar syntax named to match their native properties. This library purposefuly minimizes the repetitive code of defining view hierarchies and building constraints while maximizing constraint flexibility via optional parameters.

<p align="center">
<img src="https://github.com/SwiftKickMobile/SwiftAutoLayout/blob/master/Design/SwiftAutoLayoutBanner.gif" />
</p>

## 🔥 View Controllers 🔥

SwiftMessages can now present view controllers using the `SwiftMessagesSegue` custom modal segue!

<p align="center">
<img src="./Design/SwiftMessagesSegue.gif" />
</p>

[`SwiftMessagesSegue`](./SwiftMessages/SwiftMessagesSegue.swift) is a subclass of `UIStoryboardSegue` that integrates directly into Interface Builder as a custom modal segue, enabling view controllers to take advantage of SwiftMessages layouts, animations and more. `SwiftMessagesSegue` works with any UIKIt project — storyboards are not required. Refer to the View Controllers readme below for more information.

#### [View Controllers Readme](./ViewControllers.md)

And check out our blog post [Elegant Custom UIViewController Transitioning](http://www.swiftkickmobile.com/elegant-custom-uiviewcontroller-transitioning-uiviewcontrollertransitioningdelegate-uiviewcontrolleranimatedtransitioning/) to learn a great technique you can use to build your own custom segues that utilize `UIViewControllerTransitioningDelegate` and `UIViewControllerAnimatedTransitioning`.

<p align="center">
<img src="./Design/swiftmessages.png" />
</p>
Expand All @@ -56,6 +32,20 @@ Try exploring [the demo app via appetize.io](http://goo.gl/KXw4nD) to get a feel
<a href="http://goo.gl/KXw4nD"><img src="./Demo/appetize.png" /></a>
</p>

## View Controllers

SwiftMessages can present view controllers using the `SwiftMessagesSegue` custom modal segue!

<p align="center">
<img src="./Design/SwiftMessagesSegue.gif" />
</p>

[`SwiftMessagesSegue`](./SwiftMessages/SwiftMessagesSegue.swift) is a subclass of `UIStoryboardSegue` that integrates directly into Interface Builder as a custom modal segue, enabling view controllers to take advantage of SwiftMessages layouts, animations and more. `SwiftMessagesSegue` works with any UIKIt project — storyboards are not required. Refer to the View Controllers readme below for more information.

#### [View Controllers Readme](./ViewControllers.md)

And check out our blog post [Elegant Custom UIViewController Transitioning](http://www.swiftkickmobile.com/elegant-custom-uiviewcontroller-transitioning-uiviewcontrollertransitioningdelegate-uiviewcontrolleranimatedtransitioning/) to learn a great technique you can use to build your own custom segues that utilize `UIViewControllerTransitioningDelegate` and `UIViewControllerAnimatedTransitioning`.

## Installation

### CocoaPods
Expand Down
2 changes: 1 addition & 1 deletion SwiftMessages.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'SwiftMessages'
spec.version = '6.0.1'
spec.version = '6.0.2'
spec.license = { :type => 'MIT' }
spec.homepage = 'https://github.com/SwiftKickMobile/SwiftMessages'
spec.authors = { 'Timothy Moose' => '[email protected]' }
Expand Down
46 changes: 26 additions & 20 deletions SwiftMessages/SwiftMessagesSegue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,32 @@ open class SwiftMessagesSegue: UIStoryboardSegue {
case backgroundVertical
}

/// The presentation style to use. See the SwiftMessages.PresentationStyle for details.
public var presentationStyle: SwiftMessages.PresentationStyle {
get { return messenger.defaultConfig.presentationStyle }
set { messenger.defaultConfig.presentationStyle = newValue }
}

/// The dim mode to use. See the SwiftMessages.DimMode for details.
public var dimMode: SwiftMessages.DimMode {
get { return messenger.defaultConfig.dimMode}
set { messenger.defaultConfig.dimMode = newValue }
}

/// Specifies whether or not the interactive pan-to-hide gesture is enabled
/// on the message view. The default value is `true`, but may not be appropriate
/// for view controllers that use swipe or pan gestures.
public var interactiveHide: Bool {
get { return messenger.defaultConfig.interactiveHide }
set { messenger.defaultConfig.interactiveHide = newValue }
}

/// Specifies an optional array of event listeners.
public var eventListeners: [SwiftMessages.EventListener] {
get { return messenger.defaultConfig.eventListeners }
set { messenger.defaultConfig.eventListeners = newValue }
}

/**
The view that is passed to `SwiftMessages.show(config:view:)` during presentation.
The view controller's view is installed into `containerView`, which is itself installed
Expand All @@ -132,26 +158,6 @@ open class SwiftMessagesSegue: UIStoryboardSegue {
*/
public var containment: Containment = .content

/// The presentation style to use. See the SwiftMessages.PresentationStyle for details.
public var presentationStyle: SwiftMessages.PresentationStyle {
get { return messenger.defaultConfig.presentationStyle }
set { messenger.defaultConfig.presentationStyle = newValue }
}

/// The dim mode to use. See the SwiftMessages.DimMode for details.
public var dimMode: SwiftMessages.DimMode {
get { return messenger.defaultConfig.dimMode}
set { messenger.defaultConfig.dimMode = newValue }
}

/// Specifies whether or not the interactive pan-to-hide gesture is enabled
/// on the message view. The default value is `true`, but may not be appropriate
/// for view controllers that use swipe or pan gestures.
public var interactiveHide: Bool {
get { return messenger.defaultConfig.interactiveHide }
set { messenger.defaultConfig.interactiveHide = newValue }
}

private var messenger = SwiftMessages()
private var selfRetainer: SwiftMessagesSegue? = nil
private lazy var hider = { return TransitioningDismisser(segue: self) }()
Expand Down

0 comments on commit b7dfd57

Please sign in to comment.