https://github.com/naturally-inviting/swift-tca-custom-alert
Custom modals and alerts using SwiftUI and TCA!
https://github.com/naturally-inviting/swift-tca-custom-alert
ios swift swift-composable-architecture swift-package-manager
Last synced: 24 days ago
JSON representation
Custom modals and alerts using SwiftUI and TCA!
- Host: GitHub
- URL: https://github.com/naturally-inviting/swift-tca-custom-alert
- Owner: Naturally-Inviting
- License: mit
- Created: 2023-01-12T17:08:17.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-01T02:03:50.000Z (over 1 year ago)
- Last Synced: 2025-10-10T03:45:39.383Z (26 days ago)
- Topics: ios, swift, swift-composable-architecture, swift-package-manager
- Language: Swift
- Homepage:
- Size: 17.1 MB
- Stars: 7
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TCACustomAlert
[](https://swiftpackageindex.com/Naturally-Inviting/TCACustomAlert)
[](https://swiftpackageindex.com/Naturally-Inviting/TCACustomAlert)

## 📝 Description
This package allows for custom alert presentation with [The Composable Architecture](https://github.com/pointfreeco/swift-composable-architecture) from [Point-Free](https://www.pointfree.co).
### Installation
Install in Xcode as a package dependency.
1. From the **File** menu, select **Add Packages...**
2. Enter `https://github.com/Naturally-Inviting/swift-tca-custom-alert` into the package URL field.
## Basics
To create an alert, you need to have a store which can scope the changes of `CustomTcaAlert.State` and `CustomTcaAlert.Action`. Then pass in a view as the alert content.
```swift
import TCACustomAlert
struct MyView: View {
let store: StoreOf
var body: some View {
VStack {
ContentView()
}
.customTcaAlert(
store.scope(
state: \.alertState,
action: \.alert
),
content: {
VStack(spacing: 16) {
Text("Hello")
.font(.headline)
Button("Dismiss", action: { store.send(.alert(.dismiss)) })
.padding(.top)
}
.padding()
.background()
.cornerRadius(8)
.padding(.horizontal)
}
)
}
}
```
### Demo
This demo application can be accessed via `TCACustomAlert.xcworkspace`.
| Presentation Demo |
| :-------------------------------: |
|
|
## 🏎️ Road Map
- [x] Tests
- [ ] Accessibility