Loaf alternatives and similar libraries
Based on the "Alert" category.
Alternatively, view Loaf ๐ alternatives based on common mentions on social networks and blogs.
-
SwiftMessages
A very flexible message bar for iOS written in Swift. -
SwiftEntryKit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps. -
Alerts Pickers
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date... -
NotificationBanner
The easiest way to display highly customizable in app notification banners in iOS -
PopupDialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style. -
Whisper
:mega: Whisper is a component that will make the task of display messages and in-app notifications simple. It has three different views inside -
XLActionController
Fully customizable and extensible action sheet controller written in Swift -
PMAlertController
PMAlertController is a great and customizable alert that can substitute UIAlertController -
Jelly
๐ - Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexible API. -
CDAlertView
Highly customizable alertview and alert/notification/success/error/alarm popup written in Swift -
Queuer
Queuer is a queue manager, built on top of OperationQueue and Dispatch (aka GCD). -
SPAlert
Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets. [Moved to: https://github.com/varabeis/SPAlert] -
StatusAlert
Display Apple system-like self-hiding status alerts. It is well suited for notifying user without interrupting user flow in iOS-like way. -
SPIndicator
Floating indicator, mimicrate to indicator which appear when silent mode switched. Can be present from top and bottom. Interactive with gesters. -
SwiftOverlays
SwiftOverlays is a Swift GUI library for displaying various popups and notifications -
Toast-Swift
A Swift Toast view - iOS 14 style and newer - built with UIKit. ๐ -
AwaitToast
๐ An async waiting toast with basic toast. Inspired by facebook posting toast -
FCAlertView
FCAlertView is a Flat Customizable AlertView for iOS (Swift) -
Indicate
Interactive notification pop-over (aka "Toast) modeled after the iOS AirPods and Apple Pencil indicator. -
MaterialActionSheetController
A Google like action sheet for iOS written in Swift. -
ALRT
An easier constructor for UIAlertController. Present an alert from anywhere. -
Notie
In-app notification in Swift, with customizable buttons and input text field. -
GSAlert
[deprecated] UIAlertController support iOS 7+ and written in swift. -
SwiftAlertController
Nice and easy UIAlertController extensions
Appwrite - The open-source backend cloud platform
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Loaf or a related project?
README
Loaf ๐ Inspired by Android's Toast, Loaf is a Swifty Framework for Easy iOS Toasts
Usage
From any view controller, a Loaf can be presented by calling:
Loaf("Message goes here", sender: self).show()
Which will result in:
Bellow, I will discuss how to further customize your Loaf!
Playground
I've provided an example project to showcase uses of Loaf! Simply clone this repo, and open LoafExamples.xcodeproj
. From here you can see and experiment custom Loaf styles in Examples.swift
Customization
Basic styles
Loaf comes with 4 basic style out of the box.
Success | Error |
---|---|
Warning | Info |
---|---|
These styles can be specified in the style
property.
For instance, to use Success
styled Loaf, call it like so:
Loaf("This is a success loaf", state: .success, sender: self).show()
Custom styles
Loaf allows you to specify a custom style! This will let you set the colors, font, icon. and icon alignment. Here are some examples of custom Loaf styles!
Colors and icon | Right icon alignment | No icon |
---|---|---|
All of these properties are specified as part of custom state, like so:
Loaf("Switched to light mode", state: .custom(.init(backgroundColor: .black, icon: UIImage(named: "moon"))), sender: self).show()
Presenting and dismissing
Loaf allows you to specify the presenting and dismissing direction. The presenting direction is independant from the dismissal direction. Here are some examples:
Vertical | Left |
---|---|
![]() |
![]() |
Right | Mix |
---|---|
![]() |
![]() |
These are specified in the function signature, like so:
Loaf("Loaf message", presentingDirection: .left, dismissingDirection: .vertical, sender: self).show()
Location
Toasts are typically presented at the bottom of the screen, but Loaf allows you to also present them at the top of the screen. Here is an example of a Loaf being presented at the top of the view:
This is also specified in the function signature, like so:
Loaf("Loaf message", location: .top, sender: self).show()
Other
Specify the presentation duration. When presenting a Loaf with .show()
, a presentation duration can be specified. The default value is 4s, but there are presets for 2s and 8s. This is done by using .show(.short)
for 2s, or .show(.long)
for 8s. A custom duration can also be specified with .show(.custom(x))
, where x represents the duration in seconds.
โ ๏ธ New in 0.5.0
:
- A completion handler can be specified in the Loaf
show()
function signature. This block will be called when the dismissal animation is completed, or when the Loaf is tapped. This completion handler is now passed with a enum representing whether the Loaf was tapped or timmed out. Here is an example of using a completion handler:
Loaf(example.rawValue, sender: self).show { dismissalType in
switch dismissalType {
case .tapped: print("Tapped!")
case .timedOut: print("Timmed out!")
}
}
- A Loaf's width can be specified via the
Style
component. The width can be specifed as a fixed size (i.e. 280px) or as a percentage of the screen's width. (i.e.0.8
-> 80%). Here is some example usage:
Loaf(example.rawValue, state: .custom(.init(backgroundColor: .black, width: .screenPercentage(0.8))), sender: self).show()
- Loaf's will now be presented above tab bars, when possible.
- Loaf's can be manually dismissed through a global method:
Loaf.dismiss(sender: self) // Where `self` is the Loaf's presenter
Installation
Cocoapods
Loaf is on Cocoapods! After setting up Cocoapods in your project, simply add the folowing to your Podfile:
pod 'Loaf'
then run pod install
from the directory containing the Podfile!
Don't forget to include import Loaf
in every file you'd like to use Loaf
Requirements
- Swift 4.2+
- iOS 9.0+
Contributing
Pull requests, feature requests and bug reports are welcome ๐
Thanks to @kirkbyo for helping me through the tough parts of this ๐ช
Made with โค๏ธ in ๐จ๐ฆ by Mat Schmid
*Note that all licence references and agreements mentioned in the Loaf README section above
are relevant to that project's source code only.