Awesomeplayer165/PillboxView
A Pillbox Capsule-like informational view for iOS written in UIKit
Installation
PillboxView is available through Swift Package Manager.
Project Dependency
In order to support both native AppKit and UIKit, PillboxView is leveraging the NSUI project. NSUI allows a single codebase to support both platforms with less #if pragma statements
The package description file package.swift defines that dependency. You should be aware of that information before including PillboxView into your own project
Example
- Display a title message
- Show an activity indicator to show ongoing activity [IMG_439D92B0A93B-1]
- Indicate your task's success with a green checkmark [IMG_9C967D1A90FD-1]
or failure with a red x [IMG_72EF15491E30-1]
- Animates between images and frames for clean effect
The repo of a complete example app can be found here
Quick Start
Asynchronous Task
This is great for network calls to assure the user that there is something going on.
All you have to do is pass in a title message and your UIViewController's UIView
import UIKit
import PillboxView
class ViewController: UIViewController {
let pill = PillView()
override func viewDidLoad() {
super.viewDidLoad()
pill.showTask(message: "Refreshing Data", vcView: self.view)
// Update the task message while the task is ongoing
pill.updateTask(message: "Still refreshing data...")
// some time later...
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
pill.completedTask(state: true) // this indicates the task's success
}
}
}
Error
This is especially useful if you want to display a concise error message, and the task's completion time is very quick (like checking the values of a UITextField and reporting if any are invalid.)
import UIKit
import PillboxView
class ViewController: UIViewController {
let pill = PillView()
override func viewDidLoad() {
super.viewDidLoad()
pill.showError(message: "Refreshing Data", vcView: self.view)
}
}
Conclusion
Let me know how this is and help me improve this project with ideas, suggestions.
Requirements
iOS 13.0 or higher
License
PillboxView is available under the MIT license. See the LICENSE file for more info.
Package Metadata
Repository: Awesomeplayer165/PillboxView
Stars: 7
Forks: 2
Open issues: 9
Default branch: main
Primary language: swift
License: MIT
Topics: capsule, collaborate, github, github-codespaces, gitpod, ios, microsoft, pillbox, pillboxview, student-vscode, swift, uikit
README: README.md