Skip to content

Commit b7dfd57

Browse files
committed
Add event listeners to SwiftMessagesSegue
1 parent f8d4d4b commit b7dfd57

File tree

4 files changed

+47
-45
lines changed

4 files changed

+47
-45
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## 6.0.2
5+
6+
### Features
7+
8+
* #262 Add event listeners to `SwiftMessagesSegue`.
9+
410
## 6.0.1
511

612
### Features

README.md

+14-24
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,6 @@
66
[![Platform](https://img.shields.io/cocoapods/p/SwiftMessages.svg?style=flat)](http://cocoadocs.org/docsets/SwiftMessages)
77
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
88

9-
## 🔥 SwiftAutoLayout 🔥
10-
11-
Check out our new repo, [SwiftAutoLayout](https://github.com/SwiftKickMobile/SwiftAutoLayout)!
12-
13-
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.
14-
15-
<p align="center">
16-
<img src="https://github.com/SwiftKickMobile/SwiftAutoLayout/blob/master/Design/SwiftAutoLayoutBanner.gif" />
17-
</p>
18-
19-
## 🔥 View Controllers 🔥
20-
21-
SwiftMessages can now present view controllers using the `SwiftMessagesSegue` custom modal segue!
22-
23-
<p align="center">
24-
<img src="./Design/SwiftMessagesSegue.gif" />
25-
</p>
26-
27-
[`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.
28-
29-
#### [View Controllers Readme](./ViewControllers.md)
30-
31-
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`.
32-
339
<p align="center">
3410
<img src="./Design/swiftmessages.png" />
3511
</p>
@@ -56,6 +32,20 @@ Try exploring [the demo app via appetize.io](http://goo.gl/KXw4nD) to get a feel
5632
<a href="http://goo.gl/KXw4nD"><img src="./Demo/appetize.png" /></a>
5733
</p>
5834

35+
## View Controllers
36+
37+
SwiftMessages can present view controllers using the `SwiftMessagesSegue` custom modal segue!
38+
39+
<p align="center">
40+
<img src="./Design/SwiftMessagesSegue.gif" />
41+
</p>
42+
43+
[`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.
44+
45+
#### [View Controllers Readme](./ViewControllers.md)
46+
47+
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`.
48+
5949
## Installation
6050

6151
### CocoaPods

SwiftMessages.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'SwiftMessages'
3-
spec.version = '6.0.1'
3+
spec.version = '6.0.2'
44
spec.license = { :type => 'MIT' }
55
spec.homepage = 'https://github.com/SwiftKickMobile/SwiftMessages'
66
spec.authors = { 'Timothy Moose' => 'tim@swiftkick.it' }

SwiftMessages/SwiftMessagesSegue.swift

+26-20
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,32 @@ open class SwiftMessagesSegue: UIStoryboardSegue {
109109
case backgroundVertical
110110
}
111111

112+
/// The presentation style to use. See the SwiftMessages.PresentationStyle for details.
113+
public var presentationStyle: SwiftMessages.PresentationStyle {
114+
get { return messenger.defaultConfig.presentationStyle }
115+
set { messenger.defaultConfig.presentationStyle = newValue }
116+
}
117+
118+
/// The dim mode to use. See the SwiftMessages.DimMode for details.
119+
public var dimMode: SwiftMessages.DimMode {
120+
get { return messenger.defaultConfig.dimMode}
121+
set { messenger.defaultConfig.dimMode = newValue }
122+
}
123+
124+
/// Specifies whether or not the interactive pan-to-hide gesture is enabled
125+
/// on the message view. The default value is `true`, but may not be appropriate
126+
/// for view controllers that use swipe or pan gestures.
127+
public var interactiveHide: Bool {
128+
get { return messenger.defaultConfig.interactiveHide }
129+
set { messenger.defaultConfig.interactiveHide = newValue }
130+
}
131+
132+
/// Specifies an optional array of event listeners.
133+
public var eventListeners: [SwiftMessages.EventListener] {
134+
get { return messenger.defaultConfig.eventListeners }
135+
set { messenger.defaultConfig.eventListeners = newValue }
136+
}
137+
112138
/**
113139
The view that is passed to `SwiftMessages.show(config:view:)` during presentation.
114140
The view controller's view is installed into `containerView`, which is itself installed
@@ -132,26 +158,6 @@ open class SwiftMessagesSegue: UIStoryboardSegue {
132158
*/
133159
public var containment: Containment = .content
134160

135-
/// The presentation style to use. See the SwiftMessages.PresentationStyle for details.
136-
public var presentationStyle: SwiftMessages.PresentationStyle {
137-
get { return messenger.defaultConfig.presentationStyle }
138-
set { messenger.defaultConfig.presentationStyle = newValue }
139-
}
140-
141-
/// The dim mode to use. See the SwiftMessages.DimMode for details.
142-
public var dimMode: SwiftMessages.DimMode {
143-
get { return messenger.defaultConfig.dimMode}
144-
set { messenger.defaultConfig.dimMode = newValue }
145-
}
146-
147-
/// Specifies whether or not the interactive pan-to-hide gesture is enabled
148-
/// on the message view. The default value is `true`, but may not be appropriate
149-
/// for view controllers that use swipe or pan gestures.
150-
public var interactiveHide: Bool {
151-
get { return messenger.defaultConfig.interactiveHide }
152-
set { messenger.defaultConfig.interactiveHide = newValue }
153-
}
154-
155161
private var messenger = SwiftMessages()
156162
private var selfRetainer: SwiftMessagesSegue? = nil
157163
private lazy var hider = { return TransitioningDismisser(segue: self) }()

0 commit comments

Comments
 (0)