SwiftEntryKit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps.
Install / Use
/learn @huri000/SwiftEntryKitREADME
SwiftEntryKit <img align="left" height=42 src="https://github.com/huri000/assets/blob/master/swift-entrykit/project-icon.png">
🤗 Donations can be made here.
Table of Contents
- Overview
- Example Project
- Requirements
- Installation
- Usage
- Author
- Donations
- License
Overview
SwiftEntryKit is a simple yet versatile content presenter written in Swift.
Features
Banners or pop-ups are called Entries.
- Entries are displayed inside a separate UIWindow (of type EKWindow), so users are able to navigate the app freely while entries are being displayed in a non intrusive manner.
- The kit offers beautiful presets that can be themed with your own colors and fonts.
- Customization: Entries are highly customizable
- [x] Can be positioned either at the top, center, or the bottom of the screen.
- [x] Can be displayed within or outside the screen safe area.
- [x] Can be stylized: have a border, drop-shadow and round corners.
- [x] Their content and the surrounding background can be blurred, dimmed, colored or have a gradient style.
- [x] Transition animations are customizable - entrance, exit and pop (by another entry).
- [x] The user interaction with the entry or the screen can be intercepted.
- [x] Entries can be enqueued or override previous entries using the precedence attribute.
- [x] Each entry has a display priority attribute. That means that it can be dismissed only by other entry with an equal or higher priority.
- [x] Presets support accessibility.
- [x] Entries have an optional rubber banding effect while panning.
- [x] Entries can be optionally dismissed using a simple swipe gesture.
- [x] Entries can be optionally injected with lifecycle events: will and did appear/disappear.
- [x] The status bar style is settable for the display duration of the entry.
- [x] Supports navigation controllers & custom views as well!
Example Project
The example project contains various presets and examples you can use and modify as your like.
Example Project Installation
You can either use the terminal or git client such as Source Tree.
Terminal Users
$ git clone https://github.com/huri000/SwiftEntryKit.git
Git Client (Source Tree)
Clone https://github.com/huri000/SwiftEntryKit.git
Presets
| Toasts | Notes | Floats | Popups |
| --- | --- | --- | --- |
|
|
|
|
|
| Alerts | Forms | Rating | More... |
| --- | --- | --- | --- |
|
|
|
|
|
Playground
noun: a place where people can play 🏈
The example app contains a playground screen, an interface that allows you to customize your preferable entries. The playground screen has some limitations (allows to select constant values) but you can easily modify the code to suit your needs. Check it out!
The Playground Screen | Top Toast Sample
--- | ---
| 
Requirements
- iOS 9 or any higher version.
- Xcode 9 or any higher version.
- Swift 4.0 or any higher version.
- The library has not been tested with iOS 8.x.y or a lower version.
Installation
- SwiftEntryKit is compatible with Swift 5 as of release 1.0.0.
- SwiftEntryKit is compatible with Swift 4.2 as of release 0.8.1.
- Developers who use lower Swift version should install release 0.7.2.
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate SwiftEntryKit into your Xcode project using CocoaPods, specify it in your Podfile:
source 'https://github.com/cocoapods/specs.git'
platform :ios, '9.0'
use_frameworks!
pod 'SwiftEntryKit', '2.0.0'
Then, run the following command:
$ pod install
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate SwiftEntryKit into your Xcode project using Carthage, specify the following in your Cartfile:
github "huri000/SwiftEntryKit" == 2.0.0
Accio
Accio is a decentralized dependency manager driven by SwiftPM that works for iOS/tvOS/watchOS/macOS projects.
You can install Accio with Homebrew using the following command:
$ brew tap JamitLabs/Accio https://github.com/JamitLabs/Accio.git
$ brew install accio
To integrate SwiftEntryKit into your Xcode project using Accio, specify the following in your Package.swift manifest:
.package(url: "https://github.com/huri000/SwiftEntryKit", .exact("2.0.0"))
After specifying "SwiftEntryKit" as a dependency of the target in which you want to use it, run accio install.
Usage
Quick Usage
No setup is needed! Each time you wish to display an entry, just create your view and initialize an EKAttributes struct. See also the preset usage example, and the example project. likewise:
// Customized view
let customView = SomeCustomView()
/*
Do some customization on customView
*/
// Attributes struct that describes the display, style, user interaction and animations of customView.
var attributes = EKAttributes()
/*
Adjust preferable attributes
*/
And then, just call:
SwiftEntryKit.display(entry: customView, using: attributes)
The kit will replace the application main window with the EKWindow instance and display the entry.
Entry Attributes
EKAttributes is the entry's descriptor. Each time an entry is displayed, an EKAttributes struct is necessary to describe the entry's presentation, position inside the screen, the display duration, its frame constraints (if needed), its styling (corners, border and shadow), the user interaction events, the animations (in / out) and more.
Create a mutable EKAttributes structure likewise:
var attributes = EKAttributes()
Below are the properties that can be modified in the EKAttributes:
Entry Name
Entries can have names.
When an EKAttributes struct is instantiated, it is nameless, meaning, the name property is nil.
It is re
