A very flexible message bar for UIKit and SwiftUI.
MIT License
Bot releases are hidden (Show)
.swiftMessage()
modifier that takes a view builder instead of requiring that the bound value conform to MessageViewConvertible
. This syntax is more similar to the familiar sheet()
modifier syntax and provides more flexibility for constructing message views.@MainActor
to ensure that SwiftMessages is not called from a background queue..swiftMessage()
modifier that takes a view builder instead of requiring that the bound value conform to MessageViewConvertible
. This syntax is more similar to the familiar sheet()
modifier syntax and provides more flexibility for constructing message views.@MainActor
to ensure that SwiftMessages is not called from a background queue.Published by wtmoose 9 months ago
.sheet()
like variation to the .swiftMessage()
modifier that takes a view builder. This provides more flexibility for constructing message views.Published by wtmoose 12 months ago
Fixes
KeyboardTrackingView
to continue tracking the keyboard even when not installed in the view hierarchy.Published by wtmoose about 1 year ago
Published by wtmoose about 1 year ago
SwiftMessagesSeque
s from retaining the presenting view controllerPublished by wtmoose about 3 years ago
iMessageDemo
project's use of CocoaPods and the automatically generated SwiftMessages
framework scheme created by CocoaPods. The podfile was modified to delete this scheme, but Carthage users may need to run pod install
on the iMessagesDemo
project, if they have CocoaPods installed, or manually delete the iMessageDemo/Pods/Pods.xcodeproj/xcuserdata
folder.WindowViewController
to restore the key window. This change makes that logic more robust.SwiftMessagesSegue
.SwiftMessagesSegue
programmatically by supplyingWindowViewController
as the segue's source view controller.WindowViewController
initializers.windowLevel
is no longer accepted as an argument because the config
parameterpresentationContext
property.MarginAdjustable.respectSafeArea
option to exclude safe area from layout margins.becomeKeyWindow
from SwiftMessages.Config. This is a workaround for potential issues with apps that display additional windows.Published by wtmoose almost 4 years ago
Published by wtmoose about 4 years ago
Published by wtmoose over 4 years ago
Sorry for taking so long to release this.
SwiftMessages.PresentationContext.windowScene
option for targeting a specific window scene.presentationContext
, .automatic
. Previously, if the root view controller was presenting, the message would only be displayed over the presented view controller if the modalPresentationStyle
was fullScreen
or overFullScreen
. Now, messages are always displayed over presented view controllers.showDuraton
and hideDuration
on Animator
non-optional.showDuraton
and hideDuration
writable options on TopBottomAnimation
and PhysicsAnimation
.TopBottomAnimation
where messages weren't properly displayed under navigation and tab bars.SwiftMessagesSegue
.overrideUserInterfaceStyle
when view presented in its own windowPublished by wtmoose about 5 years ago
Config.prefersStatusBarHidden = true
to hide it.Published by wtmoose over 5 years ago
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.
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.
SwiftMessagesSegue