Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mahinmuhammad/floatingalertswfitui
swiftUI simple and easy to implement temporary popup Alerts
https://github.com/mahinmuhammad/floatingalertswfitui
alert ios popup smp swift swiftpackagemanager swiftui toast xcode
Last synced: 1 day ago
JSON representation
swiftUI simple and easy to implement temporary popup Alerts
- Host: GitHub
- URL: https://github.com/mahinmuhammad/floatingalertswfitui
- Owner: MahinMuhammad
- License: mit
- Created: 2023-11-12T14:44:00.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-12T15:46:05.000Z (about 1 year ago)
- Last Synced: 2024-11-14T19:42:57.524Z (2 months ago)
- Topics: alert, ios, popup, smp, swift, swiftpackagemanager, swiftui, toast, xcode
- Language: Swift
- Homepage:
- Size: 1.46 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FloatingAlert-SwiftUI
Floating Alert is a custom package for swiftUI. It enables simple and easy to implement temporary popup Alerts that autometically fade away after few moments.
If you like the project, please do not forget to star ★ this repository and follow me on GitHub.
## Preview
https://github.com/MahinMuhammad/FloatingAlertSwfitUI/assets/83515380/074d6500-5a7d-417b-b9a8-8cfa65c6cd06
## Requirements
* iOS 13.0+
* Xcode 11.2+
* Swift 5.0
* SwiftUI framework
* swift-tools-version: 5.9##Features
* Customizable floating alert view with image and message parameters
* Customizable time parameter to keep the alert on display for a perticular moment
* Parameters for a cusomized look of the alert view## Installation
### **Swift Package Manager**
You can add FloatingAlert-SwiftUI as a dependency in your Swift Package Manager-enabled project.
Follow these steps to integrate the package into your project:1. In Xcode, go to "File" -> "Add Packages...".
2. Enter the URL of this repository: https://github.com/MahinMuhammad/FloatingAlertSwfitUI
3. Choose the desired version rule.
4. Chosse the target where you want to add the package.
5. Click "Add Package".
6. Wait till Xcode varify and fetch it for you.
7. Click "Add Package".## Usage
To use FloatingAlert-SwiftUI in your SwiftUI project, follow these steps:
1. Import the CheckBoxSwiftUI module:
```swift
import FloatingAlert
```2. Create a @State property to hold the FloatingAlert view state:
```swift
@State var showFloatingAlert = false
```3. Use the 'CheckBox' view in your SwiftUI ZStack view hierarchy:
```swift
ZStack{
//other views
if viewModel.showCopiedToClipboardAlert {
FloatingAlertView(showingNotice: $showFloatingAlert, image: Image(systemName: "doc.on.clipboard"), message: "Copied to Clipboard")
}
}
```4. Add this line when you want to show the alert
```swift
showFloatingAlert = true
```5. Customize the FloatingAlert appearance by providing optional parameters:
```swift
ZStack{
//other views
if viewModel.showCopiedToClipboardAlert {
FloatingAlertView(showingNotice: $viewModel.showCopiedToClipboardAlert, image: Image(systemName: "doc.on.clipboard"), activeTime: 1.2, message: "Copied to Clipboard", opacity: 0.90, cornerRadious: 35, imageSize: 48)
}
}
```## Integration into a complete but simple code:
```swift
import SwiftUI
import FloatingAlertstruct ContentView: View {
@State var showFloatingAlert = falsevar body: some View {
ZStack{
VStack{
Button("Copy") {
showFloatingAlert = true
}
}
.padding()
if viewModel.showCopiedToClipboardAlert {
FloatingAlertView(showingNotice: $showFloatingAlert, image: Image(systemName: "doc.on.clipboard"), message: "Copied to Clipboard")
}
}
}
}```
## Author
Md. Mahinur Rahman,
iOS Developer
[email protected]## Find Me on:
[FaceBook](https://web.facebook.com/mahin5muhammad)
[Instagram](https://www.instagram.com/mahin5muhammad/)
[LinkedIn](https://www.linkedin.com/in/rahmanmahin/)
[Twitter](https://twitter.com/ImMahin)
[Website](https://mahinmuhammad.github.io/view/home.html)
[Discord](http://discordapp.com/users/Ghost_Friday#2625)## Contributing
Contributions to FloatingAlert-SwiftUI are welcome! If you encounter any issues or have ideas for improvements, please feel free to open an issue or submit a pull request.
## Feedback
Please feel free to open any [issue](https://github.com/MahinMuhammad/FloatingAlertSwfitUI/issues)
## License
FloatingAlert-SwiftUI is available under the MIT License. See the LICENSE file for more information.
Developed by
Md. Mahinur Rahman