All notable changes to this project will be documented in this file.
- Add
UIViewassociated type toEvent, e.g.willShow(UIView)so that event listeners can inspect the view. - Add
Event.id: String?property so that event listeners can reason about the view's ID.
- #482 Fix timing of
KeyboardTrackingViewcallbacks. - #483 KeyboardTrackingView causes a small space under bottom-style view
- #471 Xcode 13 issue - Enum cases with associated values cannot be marked potentially unavailable with '@available'
- Improve colors for dark mode.
- #467 Lower or equal level window's views disappear upon hide
- #466 Alert not shown after Biometry check
- #465 Fix broken Carthage build. The Carthage build was broken due to the
iMessageDemoproject's use of CocoaPods and the automatically generatedSwiftMessagesframework scheme created by CocoaPods. The podfile was modified to delete this scheme, but Carthage users may need to runpod installon theiMessagesDemoproject, if they have CocoaPods installed, or manually delete theiMessageDemo/Pods/Pods.xcodeproj/xcuserdatafolder.
- Fix app extension compile error when using CocoaPods.
- #455 #458 Restore key window after message is interacted with. When a message becomes the key window, such as if the user interacts with the message, iOS does not automatically restore the previous key window when the message is dismissed. SwiftMessages has some logic in
WindowViewControllerto restore the key window. This change makes that logic more robust.
- #447 Add the ability to show view controller in a new window with
SwiftMessagesSegue. This capability is available when usingSwiftMessagesSegueprogrammatically by supplying an instance ofWindowViewControlleras the segue's source view controller.
- This release has minor breaking changes in the
WindowViewControllerinitializers. ThewindowLevelis no longer accepted as an argument because theconfigparameter should specify the window level in thepresentationContextproperty.
- #451 Fix app extension crash
- #446 Restore previous key window on dismissal if the message assumed key window status.
- #442 Add
MarginAdjustable.respectSafeAreaoption to exclude safe area from layout margins. - #430 Support disable
becomeKeyWindowfrom SwiftMessages.Config. This is a workaround for potential issues with apps that display additional windows.
- #437 Revert to explicitly specifying "SwiftMessages" as the module in nib files.
- #440 Fix crash when using SwiftMessages in app extension
- 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.windowSceneoption 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 themodalPresentationStylewasfullScreenoroverFullScreen. Now, messages are always displayed over presented view controllers. - Made
showDuratonandhideDurationonAnimatornon-optional. - Made
showDuratonandhideDurationwritable options onTopBottomAnimationandPhysicsAnimation.
- #365 Fix an issue with customized
TopBottomAnimationwhere 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
overrideUserInterfaceStylewhen 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 = trueto hide it.
- Swift 5
- Remove deprecated APIs
- #313 Improved sizing on iPad
SwiftMessagesSegueprovides 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
preferredContentSizeproperty (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.topMessageandLayout.bottomMessageare 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
KeyboardTrackingViewclass 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
KeyboardTrackingViewinto your app even when you're not using SwiftMessages. Install into your view hierarchy by pinningKeyboardTrackingViewto 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.KeyboardTrackingViewworks by observing keyboard notifications and adjusting its height to maintain its top edge above the keyboard, thereby pushing your content up. See the comments inKeyboardTrackingViewfor 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
.centeredpresentation style, which is a shortcut for a specific configuration of thePhysicsAnimationanimator, 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
SwiftMessagesSeguecustom 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 theirbackgroundViewassigned to aCornerRoundingView.CornerRoundingViewprovides aroundsLeadingCornersoption 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
MarginAdjustableto improve configurability of layout margins. - Add rubber-banding to the interactive dismissal gesture. Rubber banding is automatically applied for views where
backgroundViewis inset from the message view's edges. - Added
showDurationandhideDurationproperties to theAnimatorprotocol (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
windowViewControllerproperty toSwiftMessages.Configfor supplying a custom subclass ofWindowViewController.
- Custom presentation styles using
TopBottomAnimationnow display properly under top and bottom bars.
- #152 Get current message being displayed without specifying an
id
- Fix #134 add support for
CenterAnimationdisplayed 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
MarginAdjustableprotocol (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 toMarginAdjustableto 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@IBDesignableand you can find sample values in the nib files included with SwiftMessages.
- Fix #100 memory leak.
- Change
Layoutenum capitalization to current Swift conventions.
- Undo change that broke
MessageViewclass 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
Identifiableprotocol by using the memory address as the ID. - Fix #113 MessageView not hiding
- Fix #87 Support manual install
- Added
.centerpresentation style with a physics-based dismissal gesture. - Added
.custom(animator:)presentation style, where you provide an instance of theAnimatorprotocol. TheTopBottomAnimationandCenterAnimationanimations both implementAnimatorand may be subclassed (configuration options will be added in a future release).PhysicsPanHandlerclass to provide a physics-based dismissal gesture. - Added
.centeredmessage view layout with elements centered and arranged vertically. - Added
configureBackgroundView(width:)andconfigureBackgroundView(sideMargin:)convenience methods toMessageView.
- #89 Add
blurdim 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.
-
MessageViewis smarter about including additional accessibility views for cases where you've added accessible elements to the view. Previously only thebuttonwas included. Now all views whereisAccessibilityElement == true.Note that all nib files now have
isAccessibilityElement == falsefortitleLabel,bodyLabelandiconLabel(titleLabelandbodyLabelare 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
.windowpresentation 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.becomeKeyWindowtotrue. 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
.viewpresentation context.
- Added a
viewcase topresentationContextfor displaying the message in a specific container view.
- Add
eventListenersoption toSwiftMessages.Configto specify a list of event listeners to be notified of message show and hide events.
- Add
ignoreDuplicatesoption toSwiftMessages.Configto specify whether or not to ignore duplicateIdentifiablemessage views.
- Add
shouldAutorotateoption toSwiftMessages.Configfor 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.defaultConfigthat can be used when calling the variants ofshow()that don't take aconfigargument 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.CardViewwith one end attached to the super view.
- Fix spacing between title and body text in
Layout.CardViewwhen body text wraps.
-
The
BaseView.contentViewproperty 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
contentViewproperty or you can remove the outlet connection in Interface Builder.
- Remove the
iconContainerproperty fromMessageView.
- Fix constraints generated by
BaseView.installContentView().
- Add support for specifying an
IconStylein theMessageView.configureTheme()convenience function.
- Add code comments.
- Initial release.