You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Highly customizable & feature rich notifications displayed below the status bar / the notch.
5
+
Highly customizable & feature rich notifications displayed below the status bar / notch / Island. Written in Swift, compatible for Obj-C! Please open a [Github issue](https://github.com/calimarkus/JDStatusBarNotification/issues), if you think anything is missing or wrong.
6
6
7
7
* Customizable colors, fonts & animations with multiple built-in styles
8
8
* Interactive & interuptable Drag-to-Dismiss
@@ -17,15 +17,11 @@ Highly customizable & feature rich notifications displayed below the status bar
17
17
* A progress bar
18
18
* Custom views (UIView or SwiftUI View)
19
19
20
-
Written in Swift, compatible for Obj-C!
21
-
22
-
Please open a [Github issue](https://github.com/calimarkus/JDStatusBarNotification/issues), if you think anything is missing or wrong.
23
-
24
-
Here's some examples of the possibilities (the pill style is the default):
20
+
Some examples of the possibilities - the pill style is the default:
@@ -59,39 +55,67 @@ See [CHANGELOG.md](CHANGELOG.md)
59
55
60
56
## Getting started
61
57
62
-
`NotificationPresenter` is a singleton. You don't need to initialize it anywhere. All examples here are written in Swift. But everything can be called from Objective-C too.
58
+
All examples here are written in Swift. But everything can be called from Objective-C too. Also checkout the example project, which has many examples and includes a convenient style editor to build a custom style.
63
59
64
-
Also checkout the example project, which has many examples and includes a convenient style editor.
You have the option to easily create & use fully customized styles.
170
209
210
+
### From SwiftUI
211
+
212
+
Modify the style in a `NotificationStyleClosure`:
213
+
214
+
```swift
215
+
var body: some View {
216
+
Button("Present/dismiss") {
217
+
isPresented.toggle()
218
+
}
219
+
.notification(isPresented: $isPresented, style: {
220
+
let s =$0.backgroundStyle
221
+
s.backgroundColor= .black
222
+
s.pillStyle.minimumWidth=150
223
+
s.pillStyle.height=44
224
+
}) {
225
+
Text("👋 Hi there!")
226
+
.font(.subheadline)
227
+
.foregroundStyle(.white)
228
+
}
229
+
}
230
+
```
231
+
232
+
### Manually
233
+
171
234
The ``PrepareStyleClosure`` provides a copy of the default style, which can then be modified. See the ``StatusBarNotificationStyle`` API for all options.
172
235
173
236
```swift
@@ -195,26 +258,36 @@ Or checkout the example project, which contains a full style editor. You can twe
195
258
196
259
### Background Styles
197
260
198
-
There's two supported background styles:
261
+
There's two supported `StatusBarNotificationBackgroundType`'s:
199
262
200
263
```swift
201
-
/// The background is a floating pill around the text. The pill size and appearance can be customized. This is the default.
202
-
StatusBarNotificationBackgroundType.pill
203
-
/// The background covers the full display width and the full status bar + navbar height.
204
-
StatusBarNotificationBackgroundType.fullWidth
264
+
enum {
265
+
/// The background is a floating pill around the text.
266
+
/// The pill size and appearance can be customized. This is the default.
267
+
.pill,
268
+
269
+
/// The background covers the full display width and the full status bar + navbar height.
270
+
.fullWidth
271
+
}
205
272
```
206
273
207
274
### Animation Types
208
275
209
-
The supported animation types:
276
+
The supported `StatusBarNotificationAnimationType`'s:
210
277
211
278
```swift
212
-
/// Slide in from the top of the screen and slide back out to the top. This is the default.
213
-
StatusBarNotificationAnimationType.move,
214
-
/// Fade-in and fade-out in place. No movement animation.
215
-
StatusBarNotificationAnimationType.fade,
216
-
/// Fall down from the top and bounce a little bit, before coming to a rest. Slides back out to the top.
217
-
StatusBarNotificationAnimationType.bounce,
279
+
enum {
280
+
/// Slide in from the top of the screen and slide
281
+
/// back out to the top. This is the default.
282
+
.move,
283
+
284
+
/// Fade-in and fade-out in place. No movement animation.
285
+
.fade,
286
+
287
+
/// Fall down from the top and bounce a little bit, before
0 commit comments