This is an example of posting a message from the top of the window:
UIApplication.shared.postView.post(badgeMessage: BadgeMessage( title: "This is a window notification", subtitle: "This notification has been posted on the key window", image: UIImage(named: "donations"), fillColor: .red ) )
BadgeMessagemodel defines what the message should look like
BadgeMessageViewis created with properties defined by the
BadgeMessageViewis posted on a
PostView adds and removes itself from the
keyWindow dynamically based on what is in its queue.
See the Example project for more on what this framework can do!
CocoaPods is a dependency manager for Cocoa projects. To integrate MessageStackView into your Xcode project using CocoaPods, specify it in your
pod 'MessageStackView', :git => 'https://github.com/3sidedcube/MessageStackView.git', :tag ~> '2.0.0'
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate MessageStackView into your Xcode project using Carthage, specify it in your
github "3sidedcube/MessageStackView" ~> 2.0.0
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the
swift compiler. To integrate MessageStackView into your project using Swift Package Manager, specify it in the
dependencies of your
dependencies: [ .package(url: "https://github.com/3sidedcube/MessageStackView.git", .upToNextMajor(from: "2.0.0")) ]
Encaspsulates the logic of when and how
UIViews should be posted and removed.
Timers which, after a given time, request to remove a previously posted
PostGestureManagerfor gesture related dismissals, e.g. pan.
PostManager handles the logic of when to post and remove a
UIViewPoster handles the actual posting and subviews.
Specifically, adding and removing the subview to the subview hierarchy, and animating when required.
PostManager references a
UIViewPoster communicating when to post and remove.
There are a few common implementations of
UIViewPoster provided in this framwork.
UIView for posting other
UIViews in a serial manner.
The animation of posted
UIViews is via a
translation from the top.
PostView is constrained to the top, leading, trailing edges of a
When a subview is posted, the
PostView constrains its edges to the added subview.
So, in this case, a posted
UIView would define its height either intrinsically or via explicit constraints, with its width determined by the
A simple wrapper of a vertical
UIStackView for posting and removing
UIViews, being a
UIStackView, are part of the
The animation of posted
UIViews is handled via the
UIStackView by setting
Message describes how a
MessageView should look, which is the view which is posted on the
BadgeMessage is similar to
Message with an updated design and interface.
UIViews width will be determined by the
UIStackView as the
fill and the
UIStackView axis is
However the height of the
UIView is driven by the
UIView itself, e.g. autolayout.
If, when posting and removing this
UIView from the
MessageStackView you want the animation to be smooth, then consider a "breakable" constraint for the height. Since the
UIStackView will animate the
isHidden property on the
UIView, which will set an explict height during animation.
|Last commit: 1 week ago|