All notable changes to this project will be documented in this file.
- Full support for Swift Package Manager
- #328 ignoreDuplicates is not working
- #412 Fix deployment target on nib files to match target
- #395 Add preliminary support for Swift Package Manager.
- #401 UIAlertController pops up but SwiftMessage layer absorbs all touches.
- Add
SwiftMessages.PresentationContext.windowScene
option for targeting a specific window scene. - Changed the behavior of the default
presentationContext
,.automatic
. Previously, if the root view controller was presenting, the message would only be displayed over the presented view controller if themodalPresentationStyle
wasfullScreen
oroverFullScreen
. Now, messages are always displayed over presented view controllers. - Made
showDuraton
andhideDuration
onAnimator
non-optional. - Made
showDuraton
andhideDuration
writable options onTopBottomAnimation
andPhysicsAnimation
.
- #365 Fix an issue with customized
TopBottomAnimation
where messages weren't properly displayed under navigation and tab bars. - #352 Fix accessibility for view controllers presented with
SwiftMessagesSegue
. - #355 Update card view layout to support centering of pure textual content
- #354 Support
overrideUserInterfaceStyle
when view presented in its own window - #360 Fix touch handing issue in iOS 13.1.3
- #382 Fix warnings in Xcode 11.4
- Support iOS 13.
- #335 Add option to hide status bar when view is displayed in a window. As of iOS 13, windows can no longer cover the status bar. The only alternative is to set
Config.prefersStatusBarHidden = true
to hide it.
- Swift 5
- Remove deprecated APIs
- #313 Improved sizing on iPad
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.
- Define sufficient width and height constraints in your view controller such that it sizes itself.
- 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.- Add explicit width and/or height constraints to
segue.messageView.backgroundView
.Note that
Layout.topMessage
andLayout.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.
- #275 Add ability to avoid the keyboard.
The
KeyboardTrackingView
class can be used to cause the message view to avoid the keyboard by sliding up when the keyboard gets too close.// Message view var config = SwiftMessages.defaultConfig config.keyboardTrackingView = KeyboardTrackingView() // Or view controller segue.keyboardTrackingView = KeyboardTrackingView()You can incorporate
KeyboardTrackingView
into your app even when you're not using SwiftMessages. Install into your view hierarchy by pinningKeyboardTrackingView
to the bottom, leading, and trailing edges of the screen. Then pin the bottom of your content that should avoid the keyboard to the topKeyboardTrackingView
. 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 inKeyboardTrackingView
for configuration options.
- #276 Add ability to hide message without animation
- #272 Add duration for
SwiftMessagesSegue
- #278 Make pan gesture recognizers public
- #262 Add event listeners to
SwiftMessagesSegue
.
- #257 The
.centered
presentation style, which is a shortcut for a specific configuration of thePhysicsAnimation
animator, provides a physics-based dismissal gesture where the view can be flung off screen. When the view goes out of the container view's bounds, the animator callsSwiftMessages.hide()
, which animates the dim view away and concludes the message view's lifecycle. There is currently a small delay of 0.2s before callinghide()
.
This change adds the ability to configure the delay by customizing the animator. For example, to set the delay to zero, one would do:
let animation = PhysicsAnimation()
animation.panHandler.hideDelay = 0
config.presentationStyle = .custom(animator: animation)
- Migrate to Swift 4.2
- Fix #228 restore shared SwiftMessages scheme
- Remove debug code that broke the view controller's section of the Demo app.
- Removed support for iOS 8.
- Add support for modal view controller presentation using
SwiftMessagesSegue
custom segue subclass. Try it out in the "View Controllers" section of the Demo app. In addition to the class documentation, more can be found in the View Controllers readme. - Update nib files to be more visually consistent with iPhone X:
- Introduce
CornerRoundingView
, which provides configurable corner rounding using squircles (the smoother method of rounding corners that you see on app icons). Nib files that feature rounded corners have theirbackgroundView
assigned to aCornerRoundingView
.CornerRoundingView
provides aroundsLeadingCorners
option to dynamically round only the leading corners of the view when presented from top or bottom (a feature used for the tab-style layouts). - Increased the default corner radius to 20. Corner radius can be changed by either modifying the nib file or
- Introduce
- Reworked the
MarginAdjustable
to improve configurability of layout margins. - Add rubber-banding to the interactive dismissal gesture. Rubber banding is automatically applied for views where
backgroundView
is inset from the message view's edges. - Added
showDuration
andhideDuration
properties to theAnimator
protocol (with default implementation that returnsnil
). These values enable animations to work for view controller presentation.
- #202 bodyLabel should set textAlignment to .natural
- #200 Automatic Presentation Context Broken
- Fix default value of
TopBottomAnimation.closePercentThreshold
- Fix #191 Prevent usage of UIApplication.shared when building for extensions
- #192 Add a way to test compilation with app extension
- #183 Added iOS app extension support at compile time.
- Fix #185 Incorrect margin adjustments in landscape
- Fix #188 Physics animation visual glitch
- Updates for Swift 4.1
- #164 Added an optional
windowViewController
property toSwiftMessages.Config
for supplying a custom subclass ofWindowViewController
.
- Custom presentation styles using
TopBottomAnimation
now display properly under top and bottom bars.
- #152 Get current message being displayed without specifying an
id
- Fix #134 add support for
CenterAnimation
displayed on top or bottom instead of center (renamed toPhysicsAnimation
).
- Fix #128 move icons out of asset catalog to prevent mysterious crash
- Fix #129 adjust layout margins on orientation change to preserve layout when iOS hides status bar in landscape.
- Fix #131 by always completing hide/show animations if application isn't active.
-
Swift 4.0 syntax
-
Added support for iOS 11 and iPhone X. From the readme:
SwiftMessages 4 supports iOS 11 out-of-the-box with built-in support for safe areas. To ensur that message view layouts look just right when overlapping safe areas, views that adopt the
MarginAdjustable
protocol (likeMessageView
) will have their layout margins automatically adjusted by SwiftMessages. However, there is no one-size-fits-all adjustment, so the following properties were added toMarginAdjustable
to allow for additional adjustments to be made to the layout margins:public protocol MarginAdjustable { ... /// Safe area top adjustment in iOS 11+ var safeAreaTopOffset: CGFloat { get set } /// Safe area bottom adjustment in iOS 11+ var safeAreaBottomOffset: CGFloat { get set } }
If you're using using custom nib files or view classes and your layouts don't look quite right, try adjusting the values of these properties.
BaseView
(the super class ofMessageView
) declares these properties to be@IBDesignable
and you can find sample values in the nib files included with SwiftMessages.
- Fix #100 memory leak.
- Change
Layout
enum capitalization to current Swift conventions.
- Undo change that broke
MessageView
class reference on nib files copied out of the SwiftMessages framework.
-
Added
SwiftMessages.hideCounted(id:)
method of hiding. The counted method hides when the number of calls toshow()
andhideCounted(id:)
for a given message ID are equal. This can be useful for messages that may be shown from multiple code paths to ensure that all paths are ready to hide.Also added
SwiftMessages.count(id:)
to get the current count andSwiftMessages.set(id:count:)
to set the current count. -
Added ways to retrieve message views currently being shown, hidden, or queued to be shown.
// Get a message view with the given ID if it is currently // being shown or hidden. if let view = SwiftMessages.current(id: "some id") { ... } // Get a message view with the given ID if is it currently // queued to be shown. if let view = SwiftMessages.queued(id: "some id") { ... } // Get a message view with the given ID if it is currently being // shown, hidden or in the queue to be shown. if let view = SwiftMessages.currentOrQueued(id: "some id") { ... }
- Fix #116 for message views that don't adopt the
Identifiable
protocol by using the memory address as the ID. - Fix #113 MessageView not hiding
- Fix #87 Support manual install
- Added
.center
presentation style with a physics-based dismissal gesture. - Added
.custom(animator:)
presentation style, where you provide an instance of theAnimator
protocol. TheTopBottomAnimation
andCenterAnimation
animations both implementAnimator
and may be subclassed (configuration options will be added in a future release).PhysicsPanHandler
class to provide a physics-based dismissal gesture. - Added
.centered
message view layout with elements centered and arranged vertically. - Added
configureBackgroundView(width:)
andconfigureBackgroundView(sideMargin:)
convenience methods toMessageView
.
- #89 Add
blur
dim mode option.
- #98 Fix touch handling in message view's background view.
- #97 Fix main thread checker warning
- Fix an issue where rapidly showing and hiding messages could result in messages becoming orphaned on-screen.
-
MessageView
is smarter about including additional accessibility views for cases where you've added accessible elements to the view. Previously only thebutton
was included. Now all views whereisAccessibilityElement == true
.Note that all nib files now have
isAccessibilityElement == false
fortitleLabel
,bodyLabel
andiconLabel
(titleLabel
andbodyLabel
are read out as part of the overall message view's text). If any of these need to be directly accessible, then copy the nib file into your project and select "Enabled" in the Accessibility section of the Identity Inspector.
- Fix regression where the UI was being blocked when using
DimMode.none
.
- Add proper support for VoiceOver. See the Accessibility section of the readme.
- Fix infinite loop bug introduced in 3.2.0.
- Added the ability to display messages for an indefinite duration while enforcing a minimum duration using
Duration.indefinite(delay:minimum)
.
This option is useful for displaying a message when a process is taking too long but you don't want to display the message if the process completes in a reasonable amount of time.
For example, if a URL load is expected to complete in 2 seconds, you may use the value unknown(delay: 2, minimum 1)
to ensure that the message will not be displayed most of the time, but will be displayed for at least 1 second if the operation takes longer than 2 seconds. By specifying a minimum duration, you can avoid hiding the message too fast if the operation finishes right after the delay interval.
- Prevent views below the dim view from receiving accessibility focus.
- Prevent taps in the message view from hiding when using interactive dim mode.
- Fix memory leak of single message view
- Fix memory leak of
MessageViews
.
- Fixed an issue where UIKit components were being instantiated off the main queue.
- Added the ability to set a custom value on
MessageView.id
. This can be useful for dismissing specific messages using a pre-definedid
.
- Changed the default behavior when a message is displayed in its own window (such as with
.window
presentation context) to no longer become the key window in order to prevent the keyboard from dismissing. If one needs the message's window to become key, this can be done by settingSwiftMessages.Config.becomeKeyWindow
totrue
. See
- Changed the internal logic of hiding a message view to always succeed to work around the problem of the hide animation failing, such as when started while the app is not active.
- Improved reliability of the automatic adjustments made to avoid message views overlapping the status bar, particularly when using the
.view
presentation context.
- Added a
view
case topresentationContext
for displaying the message in a specific container view.
- Add
eventListeners
option toSwiftMessages.Config
to specify a list of event listeners to be notified of message show and hide events.
- Add
ignoreDuplicates
option toSwiftMessages.Config
to specify whether or not to ignore duplicateIdentifiable
message views.
- Add
shouldAutorotate
option toSwiftMessages.Config
for customizing device rotation behavior when messages are presented in an overlay window. By default, message will auto-rotate.
- Enable automatic provisioning on framework target
- Support for Swift 3.0.
-
Support for Swift 2.3 and Xcode 8.
The nib files needed to be updated to Xcode 8 format to work around an iOS bug. Unfortunately, this makes it necessary to break backward compatibility with Swift 2.2 and Xcode 7.
- Fix #16 Preserve status bar visibility when displaying message in a new window.
- Add default configuration
SwiftMessages.defaultConfig
that can be used when calling the variants ofshow()
that don't take aconfig
argument or as a global base for custom configs. - Add
Array.sm_random()
function that returns a random element from the array. Can be used to create a playful message that cycles randomly through a set of emoji icons, for example.
- Fix #5 Emoji not shown!
- Fix #6 There is no way to create SwiftMessages instance as there is no public initializer
- Fix Carthage-related issues.
- New layout
Layout.TabView
— likeLayout.CardView
with one end attached to the super view.
- Fix spacing between title and body text in
Layout.CardView
when body text wraps.
-
The
BaseView.contentView
property of was removed because it no longer had any functionality in the framework.This is a minor backwards incompatible change. If you've copied one of the included nib files from a previous release, you may get a key-value coding runtime error related to contentView, in which case you can subclass the view and add a
contentView
property or you can remove the outlet connection in Interface Builder.
- Remove the
iconContainer
property fromMessageView
.
- Fix constraints generated by
BaseView.installContentView()
.
- Add support for specifying an
IconStyle
in theMessageView.configureTheme()
convenience function.
- Add code comments.
- Initial release.