Skip to content

Commit 0d1107b

Browse files
committed
Update docs
1 parent 2f7b710 commit 0d1107b

File tree

5 files changed

+60
-11
lines changed

5 files changed

+60
-11
lines changed

CHANGELOG.md

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

4-
## 6.0.3
4+
## 7.0.0
5+
6+
### Changes
7+
8+
* Swift 5
9+
* Remove deprecated APIs
510

611
### Features
712

13+
* #313 Improved sizing on iPad
14+
15+
>`SwiftMessagesSegue` provides default view controller sizing based on device, with width on iPad being limited to 500pt max. However, it is recommended that you explicitly specify size appropriate for your content using one of the following methods.
16+
1. Define sufficient width and height constraints in your view controller such that it sizes itself.
17+
1. Set the `preferredContentSize` property (a.k.a "Use Preferred Explicit Size" in Interface Builder's attribute inspector). Zeros are ignored, e.g. `CGSize(width: 0, height: 350)` only affects the height.
18+
1. Add explicit width and/or height constraints to `segue.messageView.backgroundView`.
19+
20+
>Note that `Layout.topMessage` and `Layout.bottomMessage` are always full screen width. For other layouts, the there is a maximum 500pt width on for regular horizontal size class (iPad) at 950 priority. This limit can be overridden by adding higher-priority constraints.
21+
22+
* #275 Add ability to avoid the keyboard.
23+
24+
>The `KeyboardTrackingView` class can be used to cause the message view to avoid the keyboard by sliding up when the keyboard gets too close.
25+
26+
>````swift
27+
// Message view
28+
var config = SwiftMessages.defaultConfig
29+
config.keyboardTrackingView = KeyboardTrackingView()
30+
31+
>// Or view controller
32+
segue.keyboardTrackingView = KeyboardTrackingView()
33+
````
34+
35+
>You can incorporate `KeyboardTrackingView` into your app even when you're not using SwiftMessages. Install into your view hierarchy by pinning `KeyboardTrackingView` to the bottom, leading, and trailing edges of the screen. Then pin the bottom of your content that should avoid the keyboard to the top `KeyboardTrackingView`. Use an equality constraint to strictly track the keyboard or an inequality constraint to only move when the keyboard gets too close. `KeyboardTrackingView` works by observing keyboard notifications and adjusting its height to maintain its top edge above the keyboard, thereby pushing your content up. See the comments in `KeyboardTrackingView` for configuration options.
36+
37+
838
* #276 Add ability to hide message without animation
939
* #272 Add duration for `SwiftMessagesSegue`
1040
* #278 Make pan gesture recognizers public

Demo/Demo.xcodeproj/project.pbxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
86AEDCE11D5D1DB70030232E = {
202202
CreatedOnToolsVersion = 7.3.1;
203203
DevelopmentTeam = 38R82CD868;
204-
LastSwiftMigration = 1000;
204+
LastSwiftMigration = 1020;
205205
};
206206
};
207207
};
@@ -430,7 +430,7 @@
430430
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
431431
PRODUCT_BUNDLE_IDENTIFIER = it.swiftkick.Demo;
432432
PRODUCT_NAME = "$(TARGET_NAME)";
433-
SWIFT_VERSION = 4.2;
433+
SWIFT_VERSION = 5.0;
434434
TARGETED_DEVICE_FAMILY = "1,2";
435435
};
436436
name = Debug;
@@ -446,7 +446,7 @@
446446
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
447447
PRODUCT_BUNDLE_IDENTIFIER = it.swiftkick.Demo;
448448
PRODUCT_NAME = "$(TARGET_NAME)";
449-
SWIFT_VERSION = 4.2;
449+
SWIFT_VERSION = 5.0;
450450
TARGETED_DEVICE_FAMILY = "1,2";
451451
};
452452
name = Release;

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,17 @@ SwiftMessages provides excellent VoiceOver support out-of-the-box.
179179

180180
See the `AccessibleMessage` protocol for implementing proper accessibility support in custom views.
181181

182+
### Keyboard Avoidance
183+
184+
The `KeyboardTrackingView` class can be used to cause the message view to avoid the keyboard by sliding up when the keyboard gets too close.
185+
186+
````swift
187+
var config = SwiftMessages.defaultConfig
188+
config.keyboardTrackingView = KeyboardTrackingView()
189+
````
190+
191+
You can incorporate `KeyboardTrackingView` into your app even when you're not using SwiftMessages. Install into your view hierarchy by pinning `KeyboardTrackingView` to the bottom, leading, and trailing edges of the screen. Then pin the bottom of your content that should avoid the keyboard to the top `KeyboardTrackingView`. Use an equality constraint to strictly track the keyboard or an inequality constraint to only move when the keyboard gets too close. `KeyboardTrackingView` works by observing keyboard notifications and adjusting its height to maintain its top edge above the keyboard, thereby pushing your content up. See the comments in `KeyboardTrackingView` for configuration options.
192+
182193
### Message Queueing
183194

184195
You can call `SwiftMessages.show()` as many times as you like. SwiftMessages maintains a queue and shows messages one at a time. If your view implements the `Identifiable` protocol (like `MessageView`), duplicate messages will be removed automatically. The pause between messages can be adjusted:

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.3'
3+
spec.version = '7.0.0'
44
spec.license = { :type => 'MIT' }
55
spec.homepage = 'https://github.com/SwiftKickMobile/SwiftMessages'
66
spec.authors = { 'Timothy Moose' => 'tim@swiftkick.it' }

ViewControllers.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,21 @@ segue.containerView.cornerRadius = 20
109109

110110
### Sizing
111111

112-
`SwiftMessagesSegue` provides static default view controller sizing based on device.
113-
However, it is recommended that you specify sizing appropriate for your content using
114-
one of the following methods.
115-
1. Define sufficient width and height constraints in your view controller.
116-
1. Set `preferredContentSize` (a.k.a "Use Preferred Explicit Size" in Interface Builder's attribute inspector). Zeros are ignored, e.g. `CGSize(width: 0, height: 350)` only affects the height.
112+
`SwiftMessagesSegue` provides default view controller sizing based on device, with width on iPad being limited to 500pt max. However, it is recommended that you explicitly specify size appropriate for your content using one of the following methods.
113+
1. Define sufficient width and height constraints in your view controller such that it sizes itself.
114+
1. Set the `preferredContentSize` property (a.k.a "Use Preferred Explicit Size" in Interface Builder's attribute inspector). Zeros are ignored, e.g. `CGSize(width: 0, height: 350)` only affects the height.
117115
1. Add explicit width and/or height constraints to `segue.messageView.backgroundView`.
118116

119-
Note that `Layout.topMessage` and `Layout.bottomMessage` are always full screen width. For other layouts, the there is a maximum 500pt width on iPad (regular horizontal size class) at 950 priority, which can be overridden by adding higher-priority constraints.
117+
Note that `Layout.topMessage` and `Layout.bottomMessage` are always full screen width. For other layouts, the there is a maximum 500pt width on for regular horizontal size class (iPad) at 950 priority. This limit can be overridden by adding higher-priority constraints.
118+
119+
### Keyboard Avoidance
120+
121+
The `KeyboardTrackingView` class can be used to cause the message view to avoid the keyboard by sliding up when the keyboard gets too close.
122+
123+
````swift
124+
segue.keyboardTrackingView = KeyboardTrackingView()
125+
````
126+
127+
You can incorporate `KeyboardTrackingView` into your app even when you're not using SwiftMessages. Install into your view hierarchy by pinning `KeyboardTrackingView` to the bottom, leading, and trailing edges of the screen. Then pin the bottom of your content that should avoid the keyboard to the top `KeyboardTrackingView`. Use an equality constraint to strictly track the keyboard or an inequality constraint to only move when the keyboard gets too close. `KeyboardTrackingView` works by observing keyboard notifications and adjusting its height to maintain its top edge above the keyboard, thereby pushing your content up. See the comments in `KeyboardTrackingView` for configuration options.
120128

121129
See [`SwiftMessagesSegue`](./SwiftMessages/SwiftMessagesSegue.swift) for additional documentation and technical details.

0 commit comments

Comments
 (0)